本文整理汇总了PHP中NewsStory::orderBy方法的典型用法代码示例。如果您正苦于以下问题:PHP NewsStory::orderBy方法的具体用法?PHP NewsStory::orderBy怎么用?PHP NewsStory::orderBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NewsStory
的用法示例。
在下文中一共展示了NewsStory::orderBy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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']));