/** * 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)); }
$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';
} } // 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.'));