本文整理汇总了PHP中WoW::last_news方法的典型用法代码示例。如果您正苦于以下问题:PHP WoW::last_news方法的具体用法?PHP WoW::last_news怎么用?PHP WoW::last_news使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WoW
的用法示例。
在下文中一共展示了WoW::last_news方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: LoadLastNews
private static function LoadLastNews($limit, $start)
{
if ($start > 0) {
self::$current_news_page = $start;
$offset = $start * $limit;
} else {
$offset = 0;
}
self::$last_news = DB::WoW()->select("SELECT `id`, `image`, `header_image`, `title_%s` AS `title`, `desc_%s` AS `desc`, `author`, `postdate` FROM `DBPREFIX_news` ORDER BY `postdate` DESC LIMIT %d, %d", WoW_Locale::GetLocale(), WoW_Locale::GetLocale(), $offset, $limit);
$count = count(self::$last_news);
for ($i = 0; $i < $count; $i++) {
self::$last_news[$i]['comments_count'] = DB::WoW()->selectCell("SELECT COUNT(*) FROM `DBPREFIX_blog_comments` WHERE `blog_id` = %d", self::$last_news[$i]['id']);
}
self::$total_news_count = DB::WoW()->selectCell("SELECT COUNT(*) FROM `DBPREFIX_news`");
if (self::$current_news_page > 0) {
self::$pager_data['prev'] = true;
if ($limit * ($start + 1) < self::$total_news_count) {
self::$pager_data['next'] = true;
}
} else {
self::$pager_data['prev'] = false;
if (self::$total_news_count > $limit) {
self::$pager_data['next'] = true;
}
}
}