本文整理汇总了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));
}