本文整理匯總了PHP中News::listNews方法的典型用法代碼示例。如果您正苦於以下問題:PHP News::listNews方法的具體用法?PHP News::listNews怎麽用?PHP News::listNews使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類News
的用法示例。
在下文中一共展示了News::listNews方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: calculHookCommon
private function calculHookCommon($params)
{
$pref = self::getPreferences();
$list = News::listNews();
if ($list) {
$i = 0;
foreach ($list as $val) {
$list[$i]['link'] = News::linkPost($val['id_news'], $val['link_rewrite'], $val['id_lang']);
$i++;
}
}
$this->smarty->assign(array('last_post_list' => $list, 'blog_conf' => $pref, 'linkPosts' => News::linkList(), 'img_path' => _THEME_NEWS_DIR_));
return true;
}
示例2: displayList
public function displayList()
{
$id_lang = $this->context->language->id;
$id_shop = $this->context->shop->id;
$limit_per_page = intval($this->conf['list_news_limit_page']);
$current_page = isset($_GET['p']) && is_numeric($_GET['p']) ? intval($_GET['p']) : 1;
$start = ($current_page - 1) * $limit_per_page;
$list = News::listNews($start, $limit_per_page, true, 'n.position');
$nb_articles = News::totalNews();
// first page if page not exists
$max_page = ceil($nb_articles / $limit_per_page);
$next = $current_page > 1 ? true : false;
//articles plus recents
$back = $current_page >= 1 && $current_page < $nb_pages ? true : false;
//articles precedents
$this->context->smarty->assign(array('news_list' => $list, 'next' => $next, 'back' => $back, 'curr_page' => $current_page));
$this->setTemplate('list.tpl');
}
示例3: json_encode
<?php
require_once "../../helper.php";
require_once "../../classes/News.class.php";
$helper = new Helper();
$newsObj = new News();
$result = $newsObj->listNews($_POST);
echo json_encode($result);