本文整理匯總了PHP中News::getList方法的典型用法代碼示例。如果您正苦於以下問題:PHP News::getList方法的具體用法?PHP News::getList怎麽用?PHP News::getList使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類News
的用法示例。
在下文中一共展示了News::getList方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __construct
function __construct()
{
if ($_POST) {
DB::escapePost();
News::setSubscribers();
if ($_SERVER['HTTP_REFERER']) {
$this->redirect($_SERVER['HTTP_REFERER']);
} else {
$this->redirect('/media/news/');
}
} else {
$tree = Tree::getTreeByUrl('wide');
Funcs::setMeta($tree);
if (Funcs::$uri[2] == '') {
$tree['pic'] = $tree['fields']['files_gal1'][0]['path'];
$tree['list'] = News::getList($tree['id']);
//$tree['tags']=News::getTagList($tree['id']);
View::render('news/list', $tree);
} else {
//$tree['tags']=News::getTags($tree['id']);
$tree['next'] = News::getNext($tree['id'], $tree['parent'], $tree['udate']);
$tree['prev'] = News::getPrev($tree['id'], $tree['parent'], $tree['udate']);
if (isset($_GET['print'])) {
View::render('news/print', $tree);
} else {
View::render('news/one', $tree);
}
}
}
}
示例2: listAction
/**
* 新聞列表
*/
public function listAction()
{
//當前頁碼
$page_id = (int) $this->request->getQuery('page');
$page_id = $page_id < 1 ? 1 : $page_id;
//每頁顯示條數
$limit = 20;
//新聞分類
$cat_id = (int) $this->request->getQuery('cat_id');
//關鍵字
$keyword = preg_replace('/[^\\da-z\\x{4e00}-\\x{9fa5}]/iu', '', mb_substr($this->request->getQuery('keyword'), 0, 10, 'utf-8'));
//關鍵字長度小於10,並且隻能是字符數字中文
//新聞分類列表
$model = new \News();
$categories = $model->getCategorylist();
array_unshift($categories, ['news_cat_id' => '', 'news_cat_name' => '所有分類']);
//列表查詢
$list = $model->getList($page_id, $limit, $cat_id, $keyword);
$page_html = $this->pageHtml($list['page']);
$this->view->setVars(['cat_id' => $cat_id, 'keyword' => $keyword, 'categories' => $categories, 'list' => $list['list'], 'page_html' => $page_html]);
}
示例3: Template_API
include_once "../config.inc.php";
include_once APP_INC_PATH . "class.template.php";
include_once APP_INC_PATH . "class.auth.php";
include_once APP_INC_PATH . "class.project.php";
include_once APP_INC_PATH . "class.news.php";
include_once APP_INC_PATH . "db_access.php";
$tpl = new Template_API();
$tpl->setTemplate("manage/index.tpl.html");
Auth::checkAuthentication(APP_COOKIE);
$tpl->assign("type", "news");
$role_id = Auth::getCurrentRole();
if ($role_id == User::getRoleID('administrator') || $role_id == User::getRoleID('manager')) {
if ($role_id == User::getRoleID('administrator')) {
$tpl->assign("show_setup_links", true);
}
if (@$HTTP_POST_VARS["cat"] == "new") {
$tpl->assign("result", News::insert());
} elseif (@$HTTP_POST_VARS["cat"] == "update") {
$tpl->assign("result", News::update());
} elseif (@$HTTP_POST_VARS["cat"] == "delete") {
News::remove();
}
if (@$HTTP_GET_VARS["cat"] == "edit") {
$tpl->assign("info", News::getAdminDetails($HTTP_GET_VARS["id"]));
}
$tpl->assign("list", News::getList());
$tpl->assign("project_list", Project::getAll());
} else {
$tpl->assign("show_not_allowed_msg", true);
}
$tpl->displayTemplate();
示例4: Template_Helper
* @license GNU General Public License, version 2 or later (GPL-2+)
*
* For the full copyright and license information,
* please see the COPYING and AUTHORS files
* that were distributed with this source code.
*/
require_once __DIR__ . '/../../init.php';
$tpl = new Template_Helper();
$tpl->setTemplate('manage/news.tpl.html');
Auth::checkAuthentication();
$role_id = Auth::getCurrentRole();
if ($role_id < User::ROLE_MANAGER) {
Misc::setMessage(ev_gettext('Sorry, you are not allowed to access this page.'), Misc::MSG_ERROR);
$tpl->displayTemplate();
exit;
}
if (@$_POST['cat'] == 'new') {
$res = News::insert();
Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the news entry was added successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to add the news entry.'), Misc::MSG_ERROR), -2 => array(ev_gettext('Please enter the title for this news entry.'), Misc::MSG_ERROR), -3 => array(ev_gettext('Please enter the message for this news entry.'), Misc::MSG_ERROR)));
} elseif (@$_POST['cat'] == 'update') {
$res = News::update();
Misc::mapMessages($res, array(1 => array(ev_gettext('Thank you, the news entry was updated successfully.'), Misc::MSG_INFO), -1 => array(ev_gettext('An error occurred while trying to update the news entry.'), Misc::MSG_ERROR), -2 => array(ev_gettext('Please enter the title for this news entry.'), Misc::MSG_ERROR), -3 => array(ev_gettext('Please enter the message for this news entry.'), Misc::MSG_ERROR)));
} elseif (@$_POST['cat'] == 'delete') {
News::remove();
}
if (@$_GET['cat'] == 'edit') {
$tpl->assign('info', News::getAdminDetails($_GET['id']));
}
$tpl->assign('list', News::getList());
$tpl->assign('project_list', Project::getAll());
$tpl->displayTemplate();
示例5: run
function run()
{
$id = Tree::getIdTreeByModule('news');
$list = News::getList($id, 5);
View::widget('news', array('list' => $list));
}
示例6: getListAction
public function getListAction()
{
$this->setTitle('News');
$this->setParameter('news', News::getList(TRUE));
}