本文整理汇总了PHP中create_pager函数的典型用法代码示例。如果您正苦于以下问题:PHP create_pager函数的具体用法?PHP create_pager怎么用?PHP create_pager使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了create_pager函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: intval
$count = intval($count);
if (!in_array($count, $count_expected)) {
$count = 10;
}
$keyword = $db->escape(htmlspecialchars(trim($keyword)));
if (!empty($keyword)) {
$orWhere = ' and (a.`title` like \'%' . $keyword . '%\' or a.author like \'%' . $keyword . '%\' or s.section_name like \'%' . $keyword . '%\')';
} else {
$orWhere = '';
}
$total = $db->fetchOne($get_total . $orWhere);
$total_page = ceil($total / $count);
$page = $page > $total_page ? $total_page : $page;
$page = $page <= 0 ? 1 : $page;
$offset = ($page - 1) * $count;
create_pager($page, $total_page, $total);
assign('count', $count);
assign('keyword', $keyword);
$get_content_list = 'select a.*, s.section_name from ' . $db->table('content') . ' as a';
$get_content_list .= ' left join ' . $db->table('section') . ' as s on s.id = a.section_id';
$get_content_list .= ' where a.status = 0' . $orWhere;
$get_content_list .= ' order by a.order_view asc, a.add_time desc';
$get_content_list .= ' limit ' . $offset . ',' . $count;
$content_list = $db->fetchAll($get_content_list);
if ($content_list) {
foreach ($content_list as $key => $content) {
$content_list[$key]['add_time'] = date('Y-m-d H:i:s', $content['add_time']);
}
}
assign('contentList', $content_list);
}
示例2: min
$veryLastPage += $count % $pageSize == 0 ? 0 : 1;
$veryLastPage = min((int) ($hardLimit / $pageSize), $veryLastPage);
$endPage = min($veryLastPage, $startPage + 10);
//Iterates to create several page links
for ($pageNumber = $startPage; $pageNumber < $endPage; ++$pageNumber) {
$pagerString .= create_pager($pageNumber, $page, $pageSize, $count, "pagerCatClicked");
}
$beforePageString = "";
$afterPageString = "";
$prevPage = $page - 1;
if ($page > 1) {
$beforePageString .= "<a title='{$prevPage}' href='javascript:pagerCatClicked ({$prevPage}, \"{$search}\")'>Previous</a> ";
}
// add page 0 if not in list
if ($startPage == 1 && $count > 0) {
$beforePageString .= create_pager(0, $page, $pageSize, $count, "pagerCatClicked");
}
$nextPage = $page + 1;
if ($page < $veryLastPage) {
$afterPageString .= "<a title='{$nextPage}' href='javascript:pagerCatClicked ({$nextPage}, \"{$search}\")'>Next</a> ";
}
$pagerString = "<span style=\"color:#ccc;\">Total (" . $count . ") </span>" . $beforePageString . $pagerString . $afterPageString;
echo '<div class="pagerDiv">' . $pagerString . '</div>';
//Uses a counter to keep track of each entry on the page
//Many elements such as id's and name's rely on this counter
$count = 0;
//Loops through every entry on your current page
foreach ($results->objects as $result) {
$fullName = $result->fullName;
$entriesCount = $result->entriesCount;
$description = str_replace("'", '', $result->description);
示例3: awpcp_display_ads
/**
* @deprecated 3.4
*/
function awpcp_display_ads($where, $byl, $hidepager, $grouporderby, $adorcat, $before_content = '')
{
_deprecated_function(__FUNCTION__, '3.4', 'awpcp_display_listings');
global $wpdb;
global $awpcp_plugin_path;
global $hasregionsmodule;
$output = '';
$awpcp_browsecats_pageid = awpcp_get_page_id_by_ref('browse-categories-page-name');
$browseadspageid = awpcp_get_page_id_by_ref('browse-ads-page-name');
$searchadspageid = awpcp_get_page_id_by_ref('search-ads-page-name');
// filters to provide alternative method of storing custom layouts (e.g. can be outside of this plugin's directory)
if (has_action('awpcp_browse_ads_template_action') || has_filter('awpcp_browse_ads_template_filter')) {
do_action('awpcp_browse_ads_template_action');
$output = apply_filters('awpcp_browse_ads_template_filter');
return;
} else {
if (file_exists("{$awpcp_plugin_path}/awpcp_display_ads_my_layout.php") && get_awpcp_option('activatemylayoutdisplayads')) {
include "{$awpcp_plugin_path}/awpcp_display_ads_my_layout.php";
} else {
$output .= "<div id=\"classiwrapper\">";
$uiwelcome = stripslashes_deep(get_awpcp_option('uiwelcome'));
$output .= apply_filters('awpcp-content-before-listings-page', '');
$output .= "<div class=\"uiwelcome\">{$uiwelcome}</div>";
$output .= awpcp_menu_items();
if ($hasregionsmodule == 1) {
// Do not show Region Control form when showing Search Ads page
// search result. Changing the current location will redirect the user
// to the form instead of a filterd version of the form and that's confusing
if (is_page(awpcp_get_page_id_by_ref('search-ads-page-name')) && isset($_POST['a']) && $_POST['a'] == 'dosearch') {
// do nothing
} else {
$output .= awpcp_region_control_selector();
}
}
$output .= $before_content;
$tbl_ads = $wpdb->prefix . "awpcp_ads";
$from = "{$tbl_ads}";
$ads_exist = ads_exist();
if (!$ads_exist) {
$showcategories = "<p style=\"padding:10px\">";
$showcategories .= __("There are currently no ads in the system", "AWPCP");
$showcategories .= "</p>";
$pager1 = '';
$pager2 = '';
} else {
$awpcp_image_display_list = array();
if ($adorcat == 'cat') {
$tpname = get_permalink($awpcp_browsecats_pageid);
} elseif ($adorcat == 'search') {
$tpname = get_permalink($searchadspageid);
} elseif (preg_match('/^custom:/', $adorcat)) {
$tpname = str_replace('custom:', '', $adorcat);
} else {
$tpname = get_permalink($browseadspageid);
}
$results = get_awpcp_option('adresultsperpage', 10);
$results = absint(awpcp_request_param('results', $results));
$offset = absint(awpcp_request_param('offset', 0));
if ($results === 0) {
$results = 10;
}
$args = array('order' => AWPCP_Ad::get_order_conditions($grouporderby), 'offset' => $offset, 'limit' => $results);
$ads = AWPCP_Ad::get_enabled_ads($args, array($where));
// get_where_conditions() is called from get_enabled_ads(), we need the
// WHERE conditions here to pass them to create_pager()
$where = AWPCP_Ad::get_where_conditions(array($where));
if (!isset($hidepager) || empty($hidepager)) {
//Unset the page and action here...these do the wrong thing on display ad
unset($_GET['page_id']);
unset($_POST['page_id']);
//unset($params['page_id']);
$pager1 = create_pager($from, join(' AND ', $where), $offset, $results, $tpname);
$pager2 = create_pager($from, join(' AND ', $where), $offset, $results, $tpname);
} else {
$pager1 = '';
$pager2 = '';
}
$items = awpcp_render_listings_items($ads, 'listings');
$opentable = "";
$closetable = "";
if (empty($ads)) {
$showcategories = "<p style=\"padding:20px;\">";
$showcategories .= __("There were no ads found", "AWPCP");
$showcategories .= "</p>";
$pager1 = '';
$pager2 = '';
} else {
$showcategories = smart_table($items, intval($results / $results), $opentable, $closetable);
}
}
$show_category_id = absint(awpcp_request_param('category_id'));
if (!isset($url_browsecatselect) || empty($url_browsecatselect)) {
$url_browsecatselect = get_permalink($awpcp_browsecats_pageid);
}
if ($ads_exist) {
$category_id = (int) awpcp_request_param('category_id', -1);
$category_id = $category_id === -1 ? (int) get_query_var('cid') : $category_id;
//.........这里部分代码省略.........
示例4: awpcp_opsconfig_categories
//.........这里部分代码省略.........
$selectinput = "<select name=\"category_parent_id\"><option value=\"0\">";
$selectinput .= __("Make This a Top Level Category", "AWPCP");
$selectinput .= "</option>";
$orderinput = "<input name=\"category_order\" id=\"category_order\" type=\"text\" class=\"inputbox\" value=\"{$category_order}\" size=\"3\"/>";
$categories = get_categorynameid($cat_ID, $cat_parent_ID, $exclude = '');
$selectinput .= "{$categories}\n\t\t\t\t\t</select>";
$submitbuttoncode = "<input type=\"submit\" class=\"button-primary button\" name=\"createeditadcategory\" value=\"{$aeword2}\" />";
}
// Start the page display
$output .= "<div class=\"wrap\"><h2>";
$output .= awpcp_admin_page_title(__('Manage Categories', 'AWPCP'));
$output .= "</h2>";
if (isset($message) && !empty($message)) {
$output .= $message;
}
$sidebar = awpcp_admin_sidebar();
$output .= $sidebar;
if (empty($sidebar)) {
$output .= "<div style=\"padding:10px;\">";
} else {
$output .= "<div style=\"padding:10px; width: 75%\">";
}
$output .= "<b>";
$output .= __("Icon Meanings", "AWPCP");
$output .= ":</b> <img src=\"{$awpcp_imagesurl}/edit_ico.png\" alt=\"";
$output .= __("Edit Category", "AWPCP");
$output .= "\" border=\"0\"/>";
$output .= __("Edit Category", "AWPCP");
$output .= " <img src=\"{$awpcp_imagesurl}/delete_ico.png\" alt=\"";
$output .= __("Delete Category", "AWPCP");
$output .= "\" border=\"0\"/>";
$output .= __("Delete Category", "AWPCP");
if ($hascaticonsmodule == 1 && is_installed_category_icon_module()) {
$label = __("Manage Category Icon", "AWPCP");
$output .= " <img src=\"{$awpcp_imagesurl}/icon_manage_ico.png\" alt=\"";
$output .= $label;
$output .= "\" border=\"0\"/>";
$output .= $label;
}
$output .= "\n\t\t\t </div>";
if (empty($sidebar)) {
$output .= "<div class=\"postbox\" style=\"padding:10px;\"><p>";
} else {
$output .= "<div class=\"postbox\" style=\"width:75%;float:left;padding:10px;\">";
}
$output .= "<form method=\"post\" id=\"awpcp_launch\">\n\t\t\t <input type=\"hidden\" name=\"category_id\" value=\"{$cat_ID}\" />\n\t\t\t <input type=\"hidden\" name=\"aeaction\" value=\"{$aeaction}\" />\n\t\t\t <input type=\"hidden\" name=\"offset\" value=\"{$offset}\" />\n\t\t\t <input type=\"hidden\" name=\"results\" value=\"{$results}\" />\n\n\t\t\t<span style=\"line-height: 1.3em; {$section_icon_style}\"> {$aeword1}</span>\n\t\t\t<table cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" style=\"margin: 15px 0 12px\">\n\t\t\t\t<tr>\n\t\t\t\t\t<th style=\"text-align: left; padding-bottom: 4px; width: 40%\">{$categorynameinput}</th>\n\t\t\t\t\t<th style=\"text-align: left; padding-bottom: 4px; width: 25%\">{$aeword3}</th>\n\t\t\t\t\t<th style=\"text-align: left; padding-bottom: 4px; width: 20%\">{$aeword4}</th>\n\t\t\t\t</tr>\n\t\t\t\t<tr>\n\t\t\t\t\t<td>{$categorynamefield}</td>\n\t\t\t\t\t<td>{$selectinput}</td>\n\t\t\t\t\t<td>{$orderinput}</td>\n\t\t\t\t</tr>\n\t\t\t</table>\n\n\t\t\t{$promptmovetocat}\n\n\t\t\t<div style=\"margin-top:5px;\">{$submitbuttoncode} {$addnewlink}</div>\n\t\t\t </form>\n\t\t\t </div>";
if (empty($sidebar)) {
$output .= "<div style=\"margin:0;padding:0px 0px 10px 0;\"><p>";
} else {
$output .= "<div style=\"margin:0;padding:0px 0px 10px 0;float:left;width:75%\">";
}
///////////////////////////
// Show the paginated categories list for management
//////////////////////////
$where = "category_name <> ''";
$pager1 = create_pager(AWPCP_TABLE_CATEGORIES, $where, $offset, $results, $tpname = '');
$pager2 = create_pager(AWPCP_TABLE_CATEGORIES, $where, $offset, $results, $tpname = '');
$output .= "{$pager1} <form name=\"mycats\" id=\"mycats\" method=\"post\">\n\t\t <p><input type=\"submit\" name=\"deletemultiplecategories\" class=\"button\" value=\"";
$output .= __("Delete Selected Categories", "AWPCP");
$output .= "\" />\n\t\t <input type=\"submit\" name=\"movemultiplecategories\" class=\"button\" value=\"";
$output .= __("Move Selected Categories", "AWPCP");
$output .= "\" />\n\t\t <select name=\"moveadstocategory\"><option value=\"0\">";
$output .= __("Select Move-To category", "AWPCP");
$output .= "</option>";
$movetocategories = get_categorynameid($cat_id = 0, $cat_parent_id = 0, $exclude);
$output .= "{$movetocategories}</select></p>\n\t\t<p>";
$output .= __('Delete categories should do this with existing Ads', 'AWPCP');
$output .= ": <label><input type=\"radio\" name=\"movedeleteads\" value=\"1\" checked='checked' > " . __('Move Ads to new category', 'AWPCP') . "</label>";
$output .= " <label><input type=\"radio\" name=\"movedeleteads\" value=\"2\" > " . __('Delete Ads too', 'AWPCP') . "</label></p>";
$children = awpcp_get_categories_hierarchy();
$categories = AWPCP_Category::query(array('orderby' => 'category_order, category_name', 'order' => 'ASC'));
$count = 0;
$items = awpcp_admin_categories_render_category_items($categories, $children, $offset, $results, $count);
$opentable = '<table class="listcatsh"><tr>';
$opentable .= '<td style="width:10%; text-align: center;">' . __('Category ID', 'AWPCP') . '</td>';
$opentable .= "<td style=\"width:30%;padding:5px;\"><label><input type=\"checkbox\" onclick=\"CheckAll()\" /> ";
$opentable .= __("Category Name (Total Ads)", "AWPCP");
$opentable .= "</label></td><td style=\"width:35%;padding:5px;\">";
$opentable .= __("Parent", "AWPCP");
$opentable .= "</td><td style=\"width:5%;padding:5px;\">";
$opentable .= __("Order", "AWPCP");
$opentable .= "</td><td style=\"width:20%;padding:5px;;\">";
$opentable .= __("Action", "AWPCP");
$opentable .= "</td></tr>";
$closetable = '<tr>';
$closetable .= '<td>' . __('Category ID', 'AWPCP') . '</td>';
$closetable .= '<td style="padding:5px;">';
$closetable .= __("Category Name (Total Ads)", "AWPCP");
$closetable .= "</td><td style=\"padding:5px;\">";
$closetable .= __("Parent", "AWPCP");
$closetable .= "</td><td style=\"padding:5px;\">";
$closetable .= __("Order", "AWPCP");
$closetable .= "</td><td style=\"padding:5px;\">";
$closetable .= __("Action", "AWPCP");
$closetable .= "</td></tr></table>";
$theitems = smart_table2($items, intval($results / $results), $opentable, $closetable, false);
$showcategories = "{$theitems}";
$output .= "\n\t\t<style>\n\t\ttable.listcatsh { width: 100%; padding: 0px; border: none; border: 1px solid #dddddd;}\n\t\ttable.listcatsh td { font-size: 12px; border: none; background-color: #F4F4F4;\n\t\tvertical-align: middle; font-weight: bold; }\n\t\ttable.listcatsh tr.special td { border-bottom: 1px solid #ff0000; }\n\t\ttable.listcatsc { width: 100%; padding: 0px; border: none; border: 1px solid #dddddd;}\n\t\ttable.listcatsc td { width:33%;border: none;\n\t\tvertical-align: middle; padding: 5px; font-weight: normal; }\n\t\ttable.listcatsc tr.special td { border-bottom: 1px solid #ff0000; }\n\t\t</style>\n\t\t{$showcategories}\n\t\t</form>{$pager2}</div>";
echo $output;
}