本文整理汇总了PHP中NewsStory::find方法的典型用法代码示例。如果您正苦于以下问题:PHP NewsStory::find方法的具体用法?PHP NewsStory::find怎么用?PHP NewsStory::find使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NewsStory
的用法示例。
在下文中一共展示了NewsStory::find方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: allHeadlines
function allHeadlines()
{
$s = new NewsStory();
$s->orderBy('date desc, rank desc, id desc');
$res = $s->find(array());
$out = array();
foreach ($res as $story) {
if (strlen($story->title) > 33) {
$story->title = substr($story->title, 0, 30) . '...';
}
$out[$story->id] = Date::format($story->date, 'm/d') . ' - ' . $story->title;
}
return $out;
}
示例2: template_simple
<?php
loader_import('news.Story');
loader_import('news.Functions');
$story = new NewsStory();
$story->limit($parameters['limit']);
$story->orderBy('date desc, rank desc, id desc');
if (!isset($parameters['sec'])) {
$params = array();
} else {
$params = array('category' => $parameters['sec']);
}
$res = $story->find($params);
if (!$res) {
$res = array();
}
echo template_simple('sidebar.spt', array('list' => $res, 'dates' => $parameters['dates'], 'thumbs' => $parameters['thumbs']));
示例3: elseif
//page_keywords ($obj->keywords);
}
$obj->context = $box['context'];
echo template_simple('story.spt', $obj);
} elseif (!empty($parameters['section'])) {
// view section list
if (!$parameters['limit']) {
$parameters['limit'] = appconf('limit');
}
if (!$parameters['offset']) {
$parameters['offset'] = 0;
}
$story->limit($parameters['limit']);
$story->offset($parameters['offset']);
$story->orderBy('date desc, rank desc, id desc');
$list = $story->find(array('category' => $parameters['section']));
if (!$list) {
echo template_simple('invalid_section.spt', array('error' => $story->error));
return;
}
$total = $story->total;
loader_import('saf.GUI.Pager');
$pg = new Pager($parameters['offset'], $parameters['limit'], $total);
$pg->setUrl(site_prefix() . '/index/news-app?section=' . $parameters['section']);
$pg->getInfo();
$date = false;
$newlist = array();
foreach ($list as $item) {
if ($date != $item->date) {
$date = $item->date;
$i = new StdClass();