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


PHP Articles::search方法代碼示例

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


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

示例1: get_results

 /**
  * Functions that handles with search results and display them
  * @param  string $keyword keyword for the search in database
  * @return array $articles array of articles that match with the keyword
  */
 public function get_results($keyword)
 {
     $articles = Article::get_search($keyword);
     dd($articles);
     return View::make('dojo::articles.results')->with('title', 'Results search for $keyword')->with('articles', Articles::search($keyword));
 }
開發者ID:SerdarSanri,項目名稱:Dojo,代碼行數:11,代碼來源:article.php

示例2: sprintf

    $values['channel']['title'] = sprintf(i18n::s('%s at %s'), $search, $context['channel_title']);
} else {
    $values['channel']['title'] = $context['channel_title'];
}
$values['channel']['link'] = $context['url_to_home'] . '/';
$values['channel']['description'] = $context['channel_description'];
if (isset($context['powered_by_image']) && $context['powered_by_image']) {
    $values['channel']['image'] = $context['url_to_home'] . $context['url_to_root'] . $context['powered_by_image'];
}
// depending on search type
switch ($type) {
    // search in articles
    default:
    case 'articles':
    case 'images':
        $values['items'] = Articles::search($search, 0, 30, 'feed');
        break;
        // search in files
    // search in files
    case 'files':
        $values['items'] = Files::search($search, 0, 30, 'feed');
        break;
        // search in users
    // search in users
    case 'users':
        $values['items'] = Users::search($search, 1.0, 30, 'feed');
        break;
}
// make a text
include_once 'codec.php';
include_once 'rss_codec.php';
開發者ID:rair,項目名稱:yacs,代碼行數:31,代碼來源:search.php

示例3: elseif

    }
}
// stop crawlers
if (Surfer::is_crawler()) {
    Safe::header('Status: 401 Unauthorized', TRUE, 401);
    Logger::error(i18n::s('You are not allowed to perform this operation.'));
    // ensure we have a valid category to host keywords
} elseif (!$root_category) {
    Logger::error(i18n::s('No item has been found.'));
} elseif (!Surfer::is_member()) {
    Safe::header('Status: 401 Unauthorized', TRUE, 401);
    Logger::error(i18n::s('You are not allowed to perform this operation.'));
    // ensure we have a keyword
} elseif (!$search) {
    Logger::error(i18n::s('No keyword to search for.'));
} elseif (!($articles = Articles::search($search, 1.0, 50, 'raw'))) {
    Logger::error(i18n::s('No item has been found.'));
    // create a category for this keyword if none exists yet
} elseif (!($category =& Categories::get_by_keyword($search))) {
    $fields = array();
    $fields['keywords'] = $search;
    $fields['anchor'] = $root_category;
    $fields['title'] = ucfirst($search);
    if ($fields['id'] = Categories::post($fields)) {
        Categories::clear($fields);
        $category = Categories::get($fields['id']);
    }
}
// ensure we have a valid category for found articles
if (isset($articles) && (!isset($category) || !$category)) {
    Logger::error(i18n::s('No item has been found.'));
開發者ID:rair,項目名稱:yacs,代碼行數:31,代碼來源:set_keyword.php


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