本文整理匯總了PHP中NewsStory::get方法的典型用法代碼示例。如果您正苦於以下問題:PHP NewsStory::get方法的具體用法?PHP NewsStory::get怎麽用?PHP NewsStory::get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類NewsStory
的用法示例。
在下文中一共展示了NewsStory::get方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: NewsStory
<?php
global $cgi;
loader_import('news.Story');
loader_import('news.Functions');
$story = new NewsStory();
if (!empty($parameters['story'])) {
// view story
$obj = $story->get($parameters['story']);
if (!$obj) {
echo template_simple('not_found.spt', array('error' => $story->error));
return;
}
if (!empty($parameters['highlight'])) {
loader_import('saf.Misc.Search');
$obj->body = search_bar($parameters['highlight'], '/index/news-search-action') . search_highlight($obj->body, $parameters['highlight']);
$obj->highlight = $parameters['highlight'];
}
$pages = news_page_split($obj->body);
if (!$cgi->pagenum) {
$cgi->pagenum = 1;
}
$obj->body = news_page_nav($pages, $cgi->pagenum, $obj->id, $parameters['highlight']);
$obj->pagenum = $cgi->pagenum;
if (appconf('comments')) {
$obj->comments = true;
loader_import('news.Comment');
$c = new NewsComment();
$c->orderBy('ts asc');
$obj->commentList = $c->find($obj->id);
if (!$obj->commentList) {
示例2: template_simple
<?php
loader_import('news.Story');
loader_import('news.Functions');
$s = new NewsStory();
$story = $s->get($parameters['story']);
$story->show_thumb = $parameters['thumb'];
$story->show_date = $parameters['date'];
$story->show_summary = $parameters['summary'];
echo template_simple('sidebar_single.spt', $story);