本文整理汇总了PHP中Pager::url方法的典型用法代码示例。如果您正苦于以下问题:PHP Pager::url方法的具体用法?PHP Pager::url怎么用?PHP Pager::url使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pager
的用法示例。
在下文中一共展示了Pager::url方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: action_list
public function action_list()
{
$cid = Arr::get($_GET, 'cid');
$where = array();
$where['cid'] = $cid;
$where['status'] = 'open';
$where['ORDER'] = 'id DESC';
$where = array_filter($where);
$m_article = Model::factory('article', 'cms');
$total = $m_article->count($where);
$pager = new Pager($total, 10);
$list = $m_article->select($pager->offset, $pager->size, $where)->as_array();
$m_category = Model::factory('category', 'cms');
$cat_list = $m_category->getAll()->as_array('id', 'name');
foreach ($list as &$item) {
$item['cat_name'] = isset($cat_list[$item['cid']]) ? $cat_list[$item['cid']] : '';
}
unset($item);
if (isset($_GET['get_next_page'])) {
$content = View::factory('article/list_incr');
$content->list = $list;
$next_page = $pager->next_page ? $pager->url($pager->next_page, array('cid' => $cid, 'get_next_page' => 'ajax')) : '';
header('Content-Type: application/json; charset=utf-8');
$ret = array('content' => (string) $content, 'next_page' => $next_page);
echo json_encode($ret);
exit;
}
$this->content = View::factory('article_list');
$this->content->list = $list;
$this->content->pager = $pager->render('common/pager');
$this->content->next_page = $pager->next_page ? $pager->url($pager->next_page, array('cid' => $cid, 'get_next_page' => 'ajax')) : '';
}
示例2: action_grid
public function action_grid()
{
$where = array();
$where['ORDER'] = 'id DESC';
$q = Arr::get($_GET, 'q', '');
if (!empty($q)) {
$where['file_src'] = array('like' => "%{$q}%");
}
$m_upload = Model::factory('upload');
$total = $m_upload->count($where);
$pager = new Pager($total, 20);
$list = $m_upload->select($pager->offset, $pager->size, $where)->as_array();
if ($this->auto_render !== TRUE) {
$this->content = View::factory('upload_grid_increment');
$this->content->list = $list;
$nexturl = '';
if ($pager->next_page) {
$nexturl = $pager->url($pager->next_page);
}
header('Content-Type: application/json; charset=utf-8');
$ret = array('content' => (string) $this->content, 'nexturl' => $nexturl);
echo json_encode($ret);
exit;
} else {
$this->content = View::factory('upload_grid');
}
$this->content->list = $list;
$this->content->pager = $pager;
echo $this->content;
exit;
}
示例3: action_recentbid
public function action_recentbid()
{
$logid = Arr::get($_GET, 'logid');
$item_id = Arr::get($_GET, 'id');
$where = array('id' => array('<' => $logid), 'item_id' => $item_id, 'ORDER' => 'id desc');
$size = 5;
$m_bidlog = Model::factory('bidlog', 'paimai');
$total = $m_bidlog->count($where);
$pager = new Pager($total, $size);
$list_bidlog = $m_bidlog->select($pager->offset, $pager->size, $where)->as_array();
$next_page = $pager->next_page ? $pager->url($pager->next_page) : '';
$content = View::factory('auction/bidlog');
$content->list_bidlog = $list_bidlog;
header('Content-Type: application/json; charset=utf-8');
$ret = array('content' => (string) $content, 'next_page' => $next_page);
echo json_encode($ret);
exit;
}