當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Posts::search方法代碼示例

本文整理匯總了PHP中Posts::search方法的典型用法代碼示例。如果您正苦於以下問題:PHP Posts::search方法的具體用法?PHP Posts::search怎麽用?PHP Posts::search使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Posts的用法示例。


在下文中一共展示了Posts::search方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: search

 public function search($term = '')
 {
     if (Input::method() == 'POST') {
         if (Input::post('term') !== false) {
             return Response::redirect('search/' . rawurlencode(Input::post('term')));
         }
     }
     $search = Posts::search($term, array('status' => 'published'));
     IoC::instance('search', $search, true);
     $page = new StdClass();
     $page->title = 'Search';
     IoC::instance('page', $page, true);
     Template::render('search');
 }
開發者ID:rubenvincenten,項目名稱:anchor-site,代碼行數:14,代碼來源:routes.php

示例2: search

 public function search($term = '')
 {
     if (Input::method() == 'POST') {
         if (Input::post('term') !== false) {
             return Response::redirect('search/' . rawurlencode(Input::post('term')));
         }
     }
     $search = Posts::search($term, array('status' => 'published', 'limit' => Config::get('metadata.posts_per_page', 10), 'offset' => Input::get('offset', 0)));
     IoC::instance('search', $search, true);
     $total = Posts::search_count($term, array('status' => 'published'));
     IoC::instance('total_search', $total, true);
     $page = new StdClass();
     $page->id = -1;
     $page->title = 'Search';
     IoC::instance('page', $page, true);
     Template::render('search');
 }
開發者ID:reqshark,項目名稱:anchor-cms,代碼行數:17,代碼來源:routes.php

示例3: Database

        <h3>Read our Legend</h3>
    </div>
</section>
<!-- Blogs  -->
<div class="main-container">
    <div class="main wrapper clearfix row">
        <article class="column column-9">
            <article class="single-article">
                <header>
                    <?php 
if (isset($_POST['submit'])) {
    $search = $_POST['search'];
    $database = new Database();
    $db = $database->getConection();
    $posts = new Posts($db);
    $stmt = $posts->search($search);
    while ($row_post = $stmt->fetch_assoc()) {
        ?>
                    <h1><a href="" title="blog" class="blog-title"><?php 
        echo "{$row_post['post_title']}";
        ?>
 </a></h1>
                    <h2>by: <a href="" title='author' class="author"><?php 
        echo "{$row_post['post_author']}";
        ?>
</a></h2>
                    <div class="article-info">
                        <span class="date_created"><i class="fa fa-clock-o"></i> <?php 
        echo "{$row_post['post_date']}";
        ?>
</span>
開發者ID:TensaZangetsu,項目名稱:blog,代碼行數:31,代碼來源:search.php


注:本文中的Posts::search方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。