本文整理匯總了PHP中WoW::current_news_page方法的典型用法代碼示例。如果您正苦於以下問題:PHP WoW::current_news_page方法的具體用法?PHP WoW::current_news_page怎麽用?PHP WoW::current_news_page使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類WoW
的用法示例。
在下文中一共展示了WoW::current_news_page方法的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;
}
}
}