本文整理汇总了PHP中Pager::paginate方法的典型用法代码示例。如果您正苦于以下问题:PHP Pager::paginate方法的具体用法?PHP Pager::paginate怎么用?PHP Pager::paginate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pager
的用法示例。
在下文中一共展示了Pager::paginate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Pager
* Created by: Randy Baker
* Created on: 23-JUL-2012
* ----------------------------------------------------
* News Headlines Page (headlines.php)
******************************************************/
/************************************
* Environment setup...
************************************/
require 'includes/application.php';
/************************************
* Initialize page variables...
************************************/
$pages = new Pager();
$pages->items_total = $intSumP = countNewsHeadlines();
$pages->mid_range = 9;
$pages->paginate();
$cnt1 = $pages->items_per_page * ($pages->current_page - 1) + 1;
$arrHeadlines = getNewsHeadlines($pages->limit, true);
/************************************
* Include the HTML header...
************************************/
include 'include/public_header.php';
?>
<!-- BEGIN: Top Content -->
<div style="font-size:10px; width:98%;">
<table cellpadding="0px" cellspacing="1px" width="100%" align="center" border="0px">
<tbody><tr>
<td style="font-size:11px; text-align:center;" valign="top">
<div style="width:200px;">
<form style="padding-left: 13px;" name="frmPRDDL" id="frmPRDDL" method="post" action="<?php
echo BASE_URL_RSB;
示例2: Request
<?php
require_once "../server/bootstrap.php";
$r = new Request();
$mode = isset($_GET['mode']) ? $_GET['mode'] : 'asc';
$page = isset($_GET['page']) ? intval($_GET['page']) : 1;
$order_by = isset($_GET['order_by']) ? $_GET['order_by'] : 'title';
$r['page'] = $page;
$r['order_by'] = $order_by;
$r['mode'] = $mode;
if (!empty($_GET['tag'])) {
$r['tag'] = $_GET['tag'];
}
$keyword = '';
if (!empty($_GET['query']) && strlen($_GET['query']) > 0) {
$keyword = substr($_GET['query'], 0, 256);
$r['query'] = $keyword;
}
$response = ProblemController::apiList($r);
$params = array('query' => $keyword, 'order_by' => $order_by, 'mode' => $mode);
if (!empty($_GET['tag'])) {
$params['tag'] = $_GET['tag'];
}
$pager_items = Pager::paginate($response['total'], $page, '/problem/list/', 5, $params);
$smarty->assign('KEYWORD', $keyword);
$smarty->assign('MODE', $mode);
$smarty->assign('ORDER_BY', $order_by);
$smarty->assign('problems', $response['results']);
$smarty->assign('pager_items', $pager_items);
$smarty->display('../templates/problems.tpl');
示例3: current
<?php
// KioCMS - Kiofol Content Managment System
// modules/news/admin/categories.php
$total_categories = current($sql->query('SELECT COUNT(id) AS categories FROM ' . DB_PREFIX . 'news_categories')->fetch());
if ($total_categories) {
$pager = new Pager('admin/modules/news/categories', $total_categories);
$pager->limit();
$pager->sort(array($lang2['ID'] => 'id', $lang2['CATEGORY_NAME'] => 'name', $lang2['DESCRIPTION'] => 'description', $lang2['TOTAL_ENTRIES'] => 'entries'), 'id', 'desc');
$query = $sql->query('
SELECT *
FROM ' . DB_PREFIX . 'news_categories
ORDER BY ' . $pager->order . '
LIMIT ' . $pager->limit . '
OFFSET ' . $pager->offset);
while ($row = $query->fetch()) {
$categories[] = $row;
}
$tpl = new PHPTAL('modules/news/admin/categories.html');
$tpl->system = $system;
$tpl->total_categories = $total_categories;
$tpl->sorters = $pager->sorters;
$tpl->limit_form = $pager->limit_form;
$tpl->categories = $categories;
$tpl->lang_admin = $lang_admin;
$tpl->lang_system = $lang_system;
$tpl->pagination = $pager->paginate();
echo $tpl->execute();
} else {
echo $lang[14];
}
示例4: getLogDetails
public function getLogDetails($dbh, $args)
{
$from_ts = isset($args['from_ts']) ? trim($args['from_ts']) : date("Y-m-d", mktime(0, 0, 0, date("m"), date("d") - 1, date("Y")));
$to_ts = isset($args['to_ts']) ? trim($args['to_ts']) : date("Y-m-d");
$today = date("Y-m-d");
$params[] = date("Y-m-d", strtotime($from_ts));
$params[] = date("Y-m-d", strtotime($to_ts));
if ($args['caltype'] == '0') {
$str_config = " SELECT u.name as oname,u.username,oncall_to,oncall_from,'P' as octype,'US' as timezone \n\t\t\t\tFROM backupTapeopencalCalendar as btc \n\t\t\t\tLEFT JOIN opencal.user as u on (btc.user_id=u.user_id) \n\t\t\t\tWHERE oncall_to BETWEEN ? AND ?";
} else {
$str_config = "SELECT \n\t\t\t\t\tu.name as oname,u.username,d.name as timezone,if(oncall_type=1,'P','S') as octype,oncall_to,oncall_from \n\t\t\t FROM backupAssigneeConfig as bac \n\t\t\t LEFT JOIN opencal.user as u on (bac.user_id=u.user_id) \n\t\t\t LEFT JOIN opencal.dictionary as d on (bac.assign_time=d.dict_id) \n\t\t\t WHERE oncall_to BETWEEN ? AND ?";
}
if (trim($args['search']) != 'any' && trim($args[search]) != '') {
$str_config .= " AND u.username like ?";
$params[] = "%" . trim($args['search']) . "%";
}
if (isset($args[timezone]) && $args[timezone] != -1) {
$str_config .= " AND bac.assign_time=?";
$params[] = $args[timezone];
}
$options = array('page' => array('per_page' => Req::has('per_page') ? Req::get('per_page') : 50, 'current_page' => Req::get('page'), 'order_by' => Req::get('order_by') ? Req::get('order_by') : 'oncall_from'));
$options['page']['query'] = $str_config;
$options['page']['db'] = $dbh;
$options['page']['params'] = $params;
$recs = Pager::paginate($options['page']);
return $recs;
}