本文整理汇总了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));
}
示例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';
示例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.'));