本文整理汇总了PHP中pagination函数的典型用法代码示例。如果您正苦于以下问题:PHP pagination函数的具体用法?PHP pagination怎么用?PHP pagination使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pagination函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: print_authlog
/**
* Display authentication log.
*
* @param array $vars
* @return none
*
*/
function print_authlog($vars)
{
$authlog = get_authlog_array($vars);
if (!$authlog['count']) {
// There have been no entries returned. Print the warning. Shouldn't happen, how did you get here without auth?!
print_warning('<h4>No authentication entries found!</h4>');
} else {
// Entries have been returned. Print the table.
$string = "<table class=\"table table-bordered table-striped table-hover table-condensed table-rounded\">\n <thead>\n <tr>\n <th style=\"width: 200px;\">Date</th>\n <th style=\"width: 200px;\">User</th>\n <th style=\"width: 200px;\">From</th>\n <th>Action</th>\n </tr>\n </thead>\n <tbody>";
foreach ($authlog['entries'] as $entry) {
if (strstr(strtolower($entry['result']), 'fail', true)) {
$class = " class=\"error\"";
} else {
$class = "";
}
$string .= '
<tr' . $class . '>
<td>' . $entry['datetime'] . '</td>
<td>' . $entry['user'] . '</td>
<td>' . $entry['address'] . '</td>
<td>' . $entry['result'] . '</td>
</tr>' . PHP_EOL;
}
$string .= ' </tbody>' . PHP_EOL;
$string .= '</table>';
// Add pagination header
if ($authlog['pagination'] && !$authlog['short']) {
$string = pagination($vars, $authlog['count']) . $string . pagination($vars, $authlog['count']);
}
// Print authlog
echo $string;
}
}
示例2: getData
/**
* Name: getData
*
* @param type $url link za paginaciju
* @param type $cookie_name naziv kolacica
* @param type $is_archive da li je anketa arhivira ili nije; 1 - jeste, 0 - nije
*/
function getData($url, $cookie_name, $is_archive = 0)
{
$q = get_cookie($cookie_name);
$perPage = $this->input->post('perPage');
$perP = $perPage ? $perPage : $q;
$has_error = 0;
$message = __('Uspesno dobavljeni podaci!!', $this->template['module']);
// var_dump($message); exit;
if (is_numeric($this->anketa->getTotalRows($is_archive))) {
pagination($url, $this->anketa->getTotalRows($is_archive), $perP, '4', 'ankete');
} else {
$has_error = 2;
$message = "Doslo je do greske.";
}
$page = uri_segment('4');
if (!($data = $this->anketa->fetch_ankete($perP, $page, $is_archive))) {
$has_error = 1;
$message = __('Trenutno nema anketa!!! Unesite anketu klikom na', $this->template['module']);
}
if (!empty($data)) {
$redni_broj = isset($page) ? $page : 0;
foreach ($data as $anketa) {
$anketa->datum_kreiranja = formatDate($anketa->datum_kreiranja);
$anketa->redni_broj = ++$redni_broj;
}
}
$links = create_links();
$uri = $page;
$result = array('data' => $data, 'links' => $links, 'error' => $has_error, 'uri' => $uri, 'poruka' => $message);
$this->response($result);
}
示例3: doWebList
public function doWebList()
{
global $_GPC, $_W;
$uniacid = $_W["uniacid"];
$pindex = max(1, intval($_GPC['page']));
$psize = 20;
$where = "";
$mark = $_GPC['mark'];
$keyword = $_GPC['keyword'];
if (!empty($mark)) {
$where .= " AND mark = '{$mark}'";
}
if (!empty($keyword)) {
$where .= " AND title like '%{$keyword}%'";
}
if (!empty($_GPC['Deleteall']) && !empty($_GPC['select'])) {
foreach ($_GPC['select'] as $k => $v) {
pdo_delete('hx_dialect_questions', array('id' => $v, 'uniacid' => $_W['uniacid']));
}
message('成功删除选中的防伪码!', referer(), 'success');
}
if (!empty($_GPC['Frozenall']) && !empty($_GPC['select'])) {
foreach ($_GPC['select'] as $k => $v) {
pdo_update('securitys_data', array('status' => 0), array('id' => $v, 'uniacid' => $_W['uniacid']));
}
message('成功冻结选中的防伪码!', referer(), 'success');
}
$list = pdo_fetchall("SELECT * from " . tablename('hx_dialect_questions') . " where uniacid='{$uniacid}' {$where} order by id asc LIMIT " . ($pindex - 1) * $psize . ',' . $psize);
$total = pdo_fetchcolumn("SELECT COUNT(*) from " . tablename('hx_dialect_questions') . " where uniacid='{$uniacid}' {$where} order by id asc");
$pager = pagination($total, $pindex, $psize);
load()->func('tpl');
include $this->template('list');
}
示例4: doWebList
public function doWebList()
{
//这个操作被定义用来呈现 管理中心导航菜单
global $_W, $_GPC;
$pindex = max(1, intval($_GPC['page']));
$psize = 20;
$condition = '';
if (!empty($_GPC['keyword'])) {
$condition .= " AND title LIKE '%{$_GPC['keyword']}%'";
}
if (!empty($_GPC['createtime'])) {
$c_s = strtotime($_GPC['createtime']['start']);
$c_e = strtotime($_GPC['createtime']['end']);
$condition .= " AND createtime >= '{$c_s}' AND createtime <= '{$c_e}'";
}
if (empty($_GPC['createtime'])) {
$c_s = time() - 86400 * 30;
$c_e = time() + 84400;
}
$list = pdo_fetchall("SELECT * FROM " . tablename('hx_pictorial') . " WHERE weid = '{$_W['uniacid']}' {$condition} ORDER BY displayorder DESC, id DESC LIMIT " . ($pindex - 1) * $psize . ',' . $psize);
$total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('hx_pictorial') . " WHERE weid = '{$_W['uniacid']}' {$condition}");
$pager = pagination($total, $pindex, $psize);
if (!empty($list)) {
foreach ($list as &$row) {
$row['total'] = pdo_fetchcolumn("SELECT COUNT(*) FROM " . tablename('hx_pictorial_photo') . " WHERE pictorialid = :pictorialid", array(':pictorialid' => $row['id']));
}
}
load()->func('tpl');
include $this->template('list');
}
示例5: doWebAwardlist
public function doWebAwardlist()
{
global $_GPC, $_W;
$id = intval($_GPC['id']);
if (checksubmit('delete')) {
pdo_delete('zzz_user', " id IN ('" . implode("','", $_GPC['select']) . "')");
message('删除成功!', $this->createWebUrl('awardlist', array('id' => $id, 'page' => $_GPC['page'])));
}
if (!empty($_GPC['wid'])) {
$wid = intval($_GPC['wid']);
pdo_update('zzz_user', array('status' => intval($_GPC['status'])), array('id' => $wid));
message('标识领奖成功!', $this->createWebUrl('awardlist', array('id' => $id, 'page' => $_GPC['page'])));
}
$pindex = max(1, intval($_GPC['page']));
$psize = 50;
$where = '';
$condition = array('mobile' => " AND `b`.`mobile` LIKE '%" . $_GPC['profilevalue'] . "%'", 'realname' => " AND `b`.`realname` LIKE '%" . $_GPC['profilevalue'] . "%'", 'nickname' => " AND `b`.`nickname` LIKE '%" . $_GPC['profilevalue'] . "%'");
if (!empty($_GPC['profile'])) {
$where .= $condition[$_GPC['profile']];
}
$sql = 'SELECT `a`.`id`, `a`.`friendcount`, `a`.`points`, `a`.`createtime`, `b`.`realname`, `b`.`nickname`, `b`.`mobile` FROM ' . tablename('zzz_user') . ' AS `a` LEFT JOIN ' . tablename('mc_mapping_fans') . ' AS `f` ON `f`.`fanid` = `a`.`fanid` LEFT
JOIN ' . tablename('mc_members') . " AS `b` ON `b`.`uid` = `f`.`uid` WHERE `a`.`rid` = :rid {$where} ORDER BY `a`.`points`\n DESC LIMIT " . ($pindex - 1) * $psize . ',' . $psize;
$params = array(':rid' => $id);
$list = pdo_fetchall($sql, $params);
if (!empty($list)) {
$sql = 'SELECT COUNT(*) FROM ' . tablename('zzz_user') . ' AS `a` LEFT JOIN ' . tablename('mc_mapping_fans') . ' AS `f` ON `f`.`fanid` =
`a`.`fanid` LEFT JOIN ' . tablename('mc_members') . ' AS `b` ON `b`.`uid` = `f`.`uid` WHERE `a`.`rid` = :rid' . $where;
$total = pdo_fetchcolumn($sql, $params);
$pager = pagination($total, $pindex, $psize);
}
include $this->template('awardlist');
}
示例6: doWebDisplay
public function doWebDisplay()
{
global $_W, $_GPC;
if (empty($_GPC['do'])) {
$_GPC['do'] = 'display';
}
$pindex = max(1, intval($_GPC['page']));
$psize = 20;
$condition = '';
if (!empty($_GPC['keyword'])) {
$condition .= " AND title LIKE '%{$_GPC['keyword']}%'";
}
if (is_array($_GPC['industry'])) {
if (!empty($_GPC['industry']['parent'])) {
$condition .= " AND industry1 = '{$_GPC['industry']['parent']}'";
}
if (!empty($_GPC['industry']['child'])) {
$condition .= " AND industry2 = '{$_GPC['industry']['child']}'";
}
}
$list = pdo_fetchall("SELECT * FROM " . tablename('business') . " WHERE weid = '{$_W['weid']}' {$condition} ORDER BY id DESC LIMIT " . ($pindex - 1) * $psize . ',' . $psize);
$total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('business') . " WHERE weid = '{$_W['weid']}' {$condition}");
$pager = pagination($total, $pindex, $psize);
include $this->template('display');
}
示例7: get_authlog_array
function get_authlog_array($vars)
{
$array = array();
// Short authlog? (no pagination, small out)
$array['short'] = isset($vars['short']) && $vars['short'];
// With pagination? (display page numbers in header)
$array['pagination'] = isset($vars['pagination']) && $vars['pagination'];
pagination($vars, 0, TRUE);
// Get default pagesize/pageno
$array['pageno'] = $vars['pageno'];
$array['pagesize'] = $vars['pagesize'];
$start = $array['pagesize'] * $array['pageno'] - $array['pagesize'];
$pagesize = $array['pagesize'];
$query = " FROM `authlog`";
$query_count = 'SELECT COUNT(`id`) ' . $query;
$query_updated = 'SELECT MAX(`datetime`) ' . $query;
$query = 'SELECT * ' . $query;
$query .= ' ORDER BY `datetime` DESC ';
$query .= "LIMIT {$start},{$pagesize}";
// Query authlog
$array['entries'] = dbFetchRows($query, $param);
// Query authlog count
if ($array['pagination'] && !$array['short']) {
$array['count'] = dbFetchCell($query_count, $param);
$array['pagination_html'] = pagination($vars, $array['count']);
} else {
$array['count'] = count($array['entries']);
}
// Query for last timestamp
$array['updated'] = dbFetchCell($query_updated, $param);
return $array;
}
示例8: index
public function index()
{
if (!$this->session->userdata('access_token')) {
redirect('login', 'refresh');
} else {
$data = $this->tq_admin_header_info();
$id = $this->input->get('id');
$results = $this->input->get('results');
$page = $this->input->get('page');
$data['results'] = $results ? $results : 10;
$data['page'] = $page ? $page : 1;
if (!empty($id)) {
$results = doCurl(API_BASE_LINK . 'priest_preach/get_priest_preach_by_id?id=' . $id . '&' . 'limit=' . $data['results'] . '&' . 'page=' . $data['page']);
if ($results && $results['http_status_code'] == 200) {
$content = json_decode($results['output']);
$status_code = $content->status_code;
if ($status_code == 200) {
$data['total'] = $content->total;
$data['content'] = $content->results;
$uri = 'priest_preach';
$data['pagination'] = pagination($content->total, $data['page'], $content->results, $uri);
}
} else {
show_404();
exit;
}
} else {
show_404();
exit;
}
$this->load->view('priest_preach/priest_preach_view', isset($data) ? $data : "");
}
}
示例9: index
public function index()
{
if ($this->session->flashdata('success')) {
$data['success'] = $this->session->flashdata('success');
} elseif ($this->session->flashdata('failed')) {
$data['failed'] = $this->session->flashdata('failed');
}
if ($this->checkTA() == FALSE) {
$this->session->set_flashdata('failed', 'Maaf, anda tidak dapat mengakses halaman tersebut!');
redirect('thread/');
}
$user = sentinel()->getUser();
$data['categoriesSide'] = $this->model_thread->get_categories();
$data['threadSide'] = $this->model_thread->get_all_threads($user->id);
$data['closeThreads'] = $this->model_thread->get_close_threads($user->id);
$data['tenagaAhli'] = $user->id;
$data['draftSide'] = $this->model_thread->get_all_drafts($user->id);
$data['authorSide'] = $this->model_thread->get_thread_from_author($user->id);
$data['provinsi'] = $this->getWilayah();
$topics = collect($this->model_topic->get_topics_from_id($user->id));
$perPage = 5;
$data['topics'] = pagination($topics, $perPage, 'topic', 'bootstrap_md');
$data['perPage'] = $perPage;
$this->load->view('topic/view', $data);
}
示例10: doWebAwardlist
public function doWebAwardlist()
{
global $_GPC, $_W;
checklogin();
$id = intval($_GPC['id']);
if (checksubmit('delete')) {
pdo_delete('zzz_user', " id IN ('" . implode("','", $_GPC['select']) . "')");
message('删除成功!', $this->createWebUrl('awardlist', array('id' => $id, 'page' => $_GPC['page'])));
}
if (!empty($_GPC['wid'])) {
$wid = intval($_GPC['wid']);
pdo_update('zzz_user', array('status' => intval($_GPC['status'])), array('id' => $wid));
message('标识领奖成功!', $this->createWebUrl('awardlist', array('id' => $id, 'page' => $_GPC['page'])));
}
$pindex = max(1, intval($_GPC['page']));
$psize = 50;
$where = '';
$condition = array('mobile' => " AND b.mobile ='{$_GPC['profilevalue']}'", 'realname' => " AND b.realname ='{$_GPC['profilevalue']}'");
if (!empty($_GPC['profile'])) {
$where .= $condition[$_GPC['profile']];
}
$sql = "SELECT a.id,a.friendcount,a.points,a.createtime, b.realname,b.nickname, b.mobile FROM " . tablename('zzz_user') . " AS a\n\t\t\t\tLEFT JOIN " . tablename('fans') . " AS b ON a.from_user = b.from_user WHERE a.rid = '{$id}' {$where} ORDER BY a.points DESC LIMIT " . ($pindex - 1) * $psize . ",{$psize}";
//echo $sql;
$list = pdo_fetchall($sql);
if (!empty($list)) {
$total = pdo_fetchcolumn("SELECT COUNT(*) FROM " . tablename('zzz_user') . " AS a\n\t\t\t\tLEFT JOIN " . tablename('fans') . " AS b ON a.from_user = b.from_user WHERE a.rid = '{$id}' {$where}");
$pager = pagination($total, $pindex, $psize);
}
include $this->template('awardlist');
}
示例11: admin_order_index
function admin_order_index()
{
$pagination = pagination(15, 'orders');
$subject_index = '<table class="table table-hover table-bordered">';
$subject_index .= '<tr><th>Order #</th><th>Order by</th><th>Order Total</th><th>Status</th><th>Modification</th></tr>';
while ($subject = mysql_fetch_array($pagination['query'])) {
$subject_index .= '<tr>';
$subject_index .= '<td>' . $subject['id'] . '</td>';
// get user name by its id !
$order_by = get_user_by_id($subject['user_id']);
$subject_index .= '<td>' . $order_by['username'] . '</td>';
$subject_index .= '<td style="color: green;">$' . $subject['order_total'] . '</td>';
if ($subject['status'] == 1) {
$subject_index .= '<td style="color: red;">Recieved</td>';
} elseif ($subject['status'] == 2) {
$subject_index .= '<td style="color: orange;">Process</td>';
} elseif ($subject['status'] == 3) {
$subject_index .= '<td style="color: green;">Completed</td>';
} else {
$subject_index .= '<td>No Status !</td>';
}
$subject_index .= '<td><a href="' . site_options('link') . 'admin/edit_order.php?order=' . $subject['id'] . '">Details </a>';
$alert = "'Are you sure you want to delete this page?'";
$subject_index .= '/ <a href="' . site_options('link') . 'admin/delete_order.php?order=' . $subject['id'] . '" onclick="return confirm(' . $alert . ');">Delete</a></td>';
$subject_index .= '</tr>';
}
$subject_index .= '</table>';
$subject_index .= $pagination['index'];
return $subject_index;
}
示例12: travel_article_search
function travel_article_search($cid, $type = '', $psize = 20, $orderby = 'id DESC')
{
global $_GPC, $_W;
$pindex = max(1, intval($_GPC['page']));
$result = array();
$condition = " WHERE weid = '{$_W['weid']}' AND ";
if (!empty($cid)) {
$category = pdo_fetch("SELECT parentid FROM " . tablename('article_category') . " WHERE id = '{$cid}'");
if (!empty($category['parentid'])) {
$condition .= "ccate = '{$cid}'";
} else {
$condition .= "pcate = '{$cid}'";
}
}
if (!empty($cid) && !empty($type)) {
$condition .= " OR ";
}
if (!empty($type)) {
$type = explode(',', $type);
foreach ($type as $item) {
$condition .= "type LIKE '%{$item},%'";
}
}
$sql = "SELECT * FROM " . tablename('travel') . $condition . ' ORDER BY ' . $orderby;
$result['list'] = pdo_fetchall($sql . " LIMIT " . ($pindex - 1) * $psize . ',' . $psize);
$total = pdo_fetchcolumn('SELECT COUNT(*) FROM ' . tablename('travel') . $condition);
$result['pager'] = pagination($total, $pindex, $psize);
return $result;
}
示例13: doWebList
public function doWebList()
{
global $_GPC, $_W;
checklogin();
$weid = $_W['account']['weid'];
//当前公众号ID
$id = intval($_GPC['id']);
$condition = '';
if (!empty($_GPC['name'])) {
$condition .= " AND ( grabername LIKE '%{$_GPC['realname']}%' OR fitername LIKE '%{$_GPC['realname']}%' )";
}
if (!empty($_GPC['mobile'])) {
$condition .= " AND ( grabermobile = '{$_GPC['mobile']}' OR fitermobile = '{$_GPC['mobile']}' )";
}
if (checksubmit('delete')) {
pdo_delete('grabseat_record', " id IN ('" . implode("','", $_GPC['select']) . "')");
message('删除成功!', $this->createWebUrl('list', array('id' => $id, 'page' => $_GPC['page'])));
}
if (!empty($_GPC['wid'])) {
$wid = intval($_GPC['wid']);
pdo_update('grabseat_record', array('status' => intval($_GPC['status'])), array('id' => $wid));
message('标识领奖成功!', $this->createWebUrl('list', array('id' => $id, 'page' => $_GPC['page'])));
}
$pindex = max(1, intval($_GPC['page']));
$psize = 25;
$list = pdo_fetchall("SELECT * FROM " . tablename('grabseat_record') . " WHERE weid = '{$_W['weid']}' {$condition} ORDER BY id DESC LIMIT " . ($pindex - 1) * $psize . ',' . $psize);
$listtotal = pdo_fetchall("SELECT * FROM " . tablename('grabseat_record') . " WHERE weid = '{$_W['weid']}' {$condition} ");
$total = count($listtotal);
$pager = pagination($total, $pindex, $psize);
include $this->template('list');
}
示例14: show
public function show()
{
$weiboid = intval($_GET['id']);
$strWeibo = $this->getOneWeibo($weiboid);
if ($weiboid == 0 || $strWeibo == '') {
ts404();
}
if ($strWeibo['isaudit'] == 1) {
tsNotice('内容审核中...');
}
//comment
$page = isset($_GET['page']) ? intval($_GET['page']) : '1';
$url = tsUrl('weibo', 'show', array('id' => $weiboid, 'page' => ''));
$lstart = $page * 20 - 20;
$arrComments = $this->findAll('weibo_comment', array('weiboid' => $weiboid), 'addtime desc', 'commentid', $lstart . ',20');
foreach ($arrComments as $key => $item) {
$arrComment[] = $this->getOneComment($item['commentid']);
}
$commentNum = $this->findCount('weibo_comment', array('weiboid' => $weiboid));
$pageUrl = pagination($commentNum, 20, $page, $url);
//他的更多唠叨
$arrWeibo = $this->findAll('weibo', array('userid' => $strWeibo['userid']), 'addtime desc', null, 20);
$weiboNum = $this->findCount('weibo', array('userid' => $strWeibo['userid']));
if ($weiboNum < 20) {
$num = 20 - $weiboNum;
$userid = $strWeibo['userid'];
$arrNewWeibo = $this->findAll('weibo', "`userid`!='{$userid}'", 'addtime desc', null, $num);
$arrWeibo = array_merge($arrWeibo, $arrNewWeibo);
}
$title = cututf8(t(tsDecode($strWeibo['content'])), 0, 100, false);
include template('show');
}
示例15: display
function display($params)
{
$Log_Model = new Log_Model();
$options_cache = Option::getAll();
extract($options_cache);
$page = isset($params[4]) && $params[4] == 'page' ? abs(intval($params[5])) : 1;
$tag = isset($params[1]) && $params[1] == 'tag' ? addslashes(urldecode(trim($params[2]))) : '';
$pageurl = '';
//page meta
$site_title = stripslashes($tag) . ' - ' . $site_title;
$Tag_Model = new Tag_Model();
$blogIdStr = $Tag_Model->getTagByName($tag);
if ($blogIdStr === false) {
show_404_page();
}
$sqlSegment = "and gid IN ({$blogIdStr}) order by date desc";
$lognum = $Log_Model->getLogNum('n', $sqlSegment);
$total_pages = ceil($lognum / $index_lognum);
if ($page > $total_pages) {
$page = $total_pages;
}
$pageurl .= Url::tag(urlencode($tag), 'page');
$logs = $Log_Model->getLogsForHome($sqlSegment, $page, $index_lognum);
$page_url = pagination($lognum, $index_lognum, $page, $pageurl);
include View::getView('header');
include View::getView('log_list');
}