本文整理汇总了PHP中pagination::show方法的典型用法代码示例。如果您正苦于以下问题:PHP pagination::show方法的具体用法?PHP pagination::show怎么用?PHP pagination::show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pagination
的用法示例。
在下文中一共展示了pagination::show方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pagination
function pagination()
{
$string = $_SERVER['REQUEST_URI'];
$pattern = '/(&page=[0-9]+)/i';
$replacement = '';
$target = preg_replace('/([&?]+page=[0-9]+)/i', '', $_SERVER['REQUEST_URI']);
$this->load->library('pagination');
$page = new pagination();
$page->target($target);
$page->limit($this->paged->page_size);
@$page->currentPage($this->paged->current_page);
$page->Items($this->paged->total_rows);
return $page->show();
}
示例2: pagination
public function pagination()
{
$string = $_SERVER["REQUEST_URI"];
$pattern = "/(&page=[0-9]+)/i";
$replacement = "";
$target = preg_replace("/([&?]+page=[0-9]+)/i", "", $_SERVER["REQUEST_URI"]);
$this->load->library("pagination");
$page = new pagination();
$page->target($target);
@$page->limit($this->paged->page_size);
@$page->currentPage($this->paged->current_page);
@$page->Items($this->paged->total_rows);
return $page->show();
}
示例3: paginate
function paginate($model, $options = array())
{
$m = new Model();
$limit = preg_match("/LIMIT (\\d+) OFFSET (\\d+)/", $model->last_query, $matches);
$limit = $matches[1];
$offset = $matches[2];
$page = $offset / $limit + 1;
$query = preg_replace("/^SELECT (.*) FROM/", "SELECT COUNT(*) AS count FROM", $model->last_query);
$query = preg_replace("/LIMIT (.*)\$/", "", $query);
$m->find_by_sql($query);
$pagination = new pagination();
$pagination->page = $page;
$pagination->target = $options['target'];
$pagination->items($m->fields['count']);
$pagination->limit($limit);
return $pagination->show();
}
示例4: Iscritti
function Iscritti()
{
require 'pagination.class.php';
global $_POST;
global $wpdb;
$table_email = $wpdb->prefix . "nl_email";
//cancellazione provamoce
if ($_POST['delete'] && $_POST['id_email']) {
$delete = $wpdb->query("delete from {$table_email} where id_email = '{$_POST['id_email']}'");
echo '<div id="message" class="updated fade"><p><strong>' . __("Email deleted succesfully!", "sendit") . '</strong></p></div>';
//print_r($_POST);
}
//modifica provamoce
if ($_POST['update']) {
//$code = md5(uniqid(rand(), true));
$update = $wpdb->query("update {$table_email} set email = '{$_POST['email']}', magic_string='{$_POST['code']}', accepted = '{$_POST['status']}' where id_email = '{$_POST['id_email']}'");
echo '<div id="message" class="updated fade"><p><strong>' . sprintf(__('email %s edited succesfully', 'sendit'), $_POST[email]) . '</p></div>';
//print_r($_POST);
}
//aggiunta indirizzo o indirizzi email dalla textarea
if ($_POST['emails_add'] != "") {
//ver 1.1 multiaddress support
$email_add = explode("\n", $_POST['emails_add']);
foreach ($email_add as $key => $value) {
//echo $value."<br />";
//validation fix 1.5.6 (also there!) {2,4}
if (!ereg("^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,4})\$", trim($value))) {
echo '<div id="message" class="error"><p><strong>indirizzo email ' . $value . ' non valido!</strong></p></div>';
} else {
$user_count = $wpdb->get_var("SELECT COUNT(*) FROM {$table_email} where email ='{$value}' and id_lista = '{$_GET['lista']}' order by email;");
if ($user_count > 0) {
echo "<div class=\"error\"><p><strong>" . sprintf(__('email %s already present', 'sendit'), $value) . "</strong></p></div>";
} else {
//genero stringa univoca x conferme e cancellazioni sicure
$code = md5(uniqid(rand(), true));
$wpdb->query("INSERT INTO {$table_email} (email,id_lista, magic_string, accepted) VALUES ('{$value}', '{$_POST['id_lista']}', '{$code}', 'y')");
echo '<div class="updated fade"><p><strong>' . sprintf(__('email %s added succesfully!', 'sendit'), $value) . '</strong></p></div>';
}
}
}
//fine ciclo for
}
$email_items = $wpdb->get_var("SELECT count(*) FROM {$table_email} where id_lista= '{$_GET['lista']}'");
// number of total rows in the database
if ($email_items > 0) {
$p = new pagination();
$p->items($email_items);
$p->limit(20);
// Limit entries per page
$p->target("admin.php?page=lista-iscritti&lista=" . $_GET['lista']);
$p->currentPage($_GET[$p->paging]);
// Gets and validates the current page
$p->calculate();
// Calculates what to show
$p->parameterName('paging');
$p->adjacents(1);
//No. of page away from the current page
if (!isset($_GET['paging'])) {
$p->page = 1;
} else {
$p->page = $_GET['paging'];
}
//Query for limit paging
$limit = "LIMIT " . ($p->page - 1) * $p->limit . ", " . $p->limit;
} else {
//echo "No Record Found";
}
$emails = $wpdb->get_results("SELECT id_email, id_lista, email, subscriber_info, magic_string, accepted FROM {$table_email} where id_lista= '{$_GET['lista']}' order by email {$limit}");
//email confermat
$emails_confirmed = $wpdb->get_results("SELECT id_email, id_lista, email, subscriber_info, magic_string, accepted FROM {$table_email} where id_lista= '{$_GET['lista']}' and accepted='y'");
echo "<div class=\"wrap\"><h2>" . __('Subscribers', 'sendit') . "</h2>";
//estraggo le liste
$table_liste = $wpdb->prefix . "nl_liste";
$liste = $wpdb->get_results("SELECT id_lista, nomelista FROM {$table_liste} ");
// print_r($_POST);
echo "<div class=\"table\">\n\t\t\t<table class=\"widefat fixed\">\n\t\t\t\t<thead>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<th>" . __('id', 'sendit') . "</th>\n\t\t\t\t\t\t<th class=" . $css_list . ">" . __('mailing list', 'sendit') . "</th>\n\t\t\t\t\t\t<th>" . __('actions', 'sendit') . "</th>\n\n\t\t\t\t\t</tr>\n\t\t\t\t</thead><tbody>";
foreach ($liste as $lista) {
if ($_GET['lista'] == $lista->id_lista) {
$selected = " class=\"updated fade\"";
} else {
$selected = "";
}
echo "<tr >\n \t\t<td>" . $lista->id_lista . "</td>\n \t\t<td " . $selected . "><a class=\"\" href=\"admin.php?page=lista-iscritti&lista=" . $lista->id_lista . "\">" . $lista->nomelista . "</a></td>\n \t\t<td></td><tr>";
}
echo "</tbody></table>\n </div><br clear=\"all\\ />";
/*miglioro facendo comparire la form x aggiungere solo se selezionata una lista*/
if ($_GET['lista']) {
echo "<h3>" . __('Manual Subscribe mailing list ', 'sendit') . " " . $_POST['lista'] . "</h3>\n\n <label for=\"email_add\">" . __('email address (one or more: default separator= line break)', 'sendit') . "<br />\n <div id=\"dashboard-widgets\" class=\"metabox-holder\">\n <div class='postbox-container' style='width:49%;'>\n\t\t\t\t<div id=\"normal-sortables\" class=\"meta-box-sortables\">\n\t\t\t\t<div id=\"dashboard_right_now\" class=\"postbox \" >\n\t\t\t\t\t<div class=\"handlediv\" title=\"Fare clic per cambiare.\"><br /></div>\n\t\t\t\t<h3 class='hndle'><span>" . __('Subscription', 'sendit') . "</span></h3>\n\t\t\t\t<div class=\"inside\">\n\t\t\t\t <p>" . __('Copy here one or more email address', 'sendit') . "</p>\n\n\t\t\t\t\t <form id=\"add\" name=\"add\" method=\"post\" action=\"admin.php?page=lista-iscritti&lista=" . $_GET[lista] . "\">\n\n \n <textarea id=\"emails_add\" type=\"text\" value=\"\" name=\"emails_add\" rows=\"10\" cols=\"50\"/></textarea></label>\n <input type=\"hidden\" name=\"id_lista\" value=\"" . $_GET[lista] . "\" /> \n\n <input class=\"button\" type=\"submit\" value=\"" . __('Add', 'sendit') . "\"/>\n </p>\n </form>\n </div>\n </div>\n </div>\n </div>\n </div>\n <br clear=\"all\" />";
//posiziono la paginazione
echo "<h3>" . __('Subscribers', 'sendit') . " n." . $email_items . " (" . __('Subscriptions confirmed', 'sendit') . ": " . count($emails_confirmed) . ")</h3>";
if ($p) {
echo $p->show();
}
echo "\n <br clear=\"all\" />\n\t\t\t<table class=\"widefat post fixed\">\n\t\t\t\t<thead>\n\t\t\t\t\t<tr>";
if (get_option('sendit_gravatar') == 'yes') {
echo "<th style=\"width:30px !important;\"></th>";
}
echo "<th>" . __('email', 'sendit') . "</th>\n\t\t\t\t\t\t<th>" . __('status', 'sendit') . "</th>\n\t\t\t\t\t\t<th>" . __('Additional info', 'sendit') . "</th>\n\t\t\t\t\t\t<th>" . __('actions', 'sendit') . "</th>\n\t\t\t\t\t</tr>\n\t\t\t\t</thead>\n \t\n ";
foreach ($emails as $email) {
//coloro le input per distinguere tra chi ha confermato e chi no
//.........这里部分代码省略.........
示例5: WassUp
//.........这里部分代码省略.........
$wassup_options->loadDefaults();
if ($wassup_options->saveSettings()) {
$admin_message = __("Wassup options updated successfully","wassup")."." ;
}
}
//#sets current tab style for Wassup admin submenu?
if ($_GET['page'] == "wassup-spy") {
$class_spy="class='current'";
} elseif ($_GET['page'] == "wassup-options") {
$class_opt="class='current'";
} elseif ($_GET['page'] == "wassup-online") {
$class_ol="class='current'";
} else {
$class_sub="class='current'";
}
//for stringShortener calculated values and max-width...-Helene D. 11/27/07, 12/6/07
if (!empty($wassup_options->wassup_screen_res)) {
$screen_res_size = (int) $wassup_options->wassup_screen_res;
} else {
$screen_res_size = 670;
}
$max_char_len = ($screen_res_size)/10;
$screen_res_size = $screen_res_size+20; //for wrap margins...
//for generating page link urls....
//$wpurl = get_bloginfo('wpurl'); //global
$siteurl = get_bloginfo('siteurl');
//#display an admin message or an alert. This must be above "wrap"
//# div. -Helene D. 2/26/08.
if (!empty($admin_message)) {
$wassup_options->showMessage($admin_message);
} elseif (!empty($wassup_options->wassup_alert_message)) {
$wassup_options->showMessage();
//#show alert message only once, so remove it here...
$wassup_options->wassup_alert_message = "";
$wassup_options->saveSettings();
}
//#debug - display MySQL errors/warnings
//$mysqlerror = $wpdb->print_error(); //debug
//if (!empty($mysqlerror)) { $wassup_options->showMessage($mysqlerror); } //debug
//moved max-width to single "wrap" div and removed it from
// the individual spans and divs in style.php... ?>
<div class="wrap" style="max-width:<?php echo $screen_res_size; ?>px;" >
<?php // HERE IS THE VISITORS ONLINE VIEW
if ($_GET['page'] == "wassup-online") { ?>
<h2><?php _e("Current Visitors Online", "wassup"); ?></h2>
<p class="legend"><?php echo __("Legend", "wassup").': <span class="box-log"> </span> '.__("Logged-in Users", "wassup").' <span class="box-aut"> </span> '.__("Comments Authors", "wassup").' <span class="box-spider"> </span> '.__("Spiders/bots", "wassup"); ?></p><br />
<p class="legend"><a href="#" class="toggle-all"><?php _e("Expand All","wassup"); ?></a></p>
<?php
$to_date = wassup_get_time();
$from_date = strtotime('-3 minutes', $to_date);
$currenttot = $wpdb->get_var("SELECT COUNT(DISTINCT wassup_id) as currenttot FROM $table_tmp_name WHERE `timestamp` BETWEEN $from_date AND $to_date");
$currenttot = $currenttot+0; //set to integer
print "<p class='legend'>".__("Visitors online", "wassup").": <strong>".$currenttot."</strong></p><br />";
if ($currenttot > 0) {
$qryC = $wpdb->get_results("SELECT id, wassup_id, max(timestamp) as max_timestamp, ip, hostname, searchengine, urlrequested, agent, referrer, spider, username, comment_author FROM $table_tmp_name WHERE `timestamp` BETWEEN $from_date AND $to_date GROUP BY ip ORDER BY max_timestamp DESC");
foreach ($qryC as $cv) {
if ($wassup_options->wassup_time_format == 24) {
$timed = gmdate("H:i:s", $cv->max_timestamp);
} else {
$timed = gmdate("h:i:s a", $cv->max_timestamp);
示例6: get
function get($sql = FALSE, $noSplitPage = FALSE)
{
$sql = $sql ? $sql : 'select ' . $this->select . ' from ' . $this->table . ' ' . $this->join . ' ' . $this->where . ' ' . $this->sort . ' ' . $this->order;
//$sql = iconv('UTF-8','TIS-620',$sql);
if ($noSplitPage == FALSE) {
$this->load->library('pagination');
$page = new pagination();
$page->target($this->target);
$page->limit($this->limit);
@$page->currentPage($this->current_page);
$rs = $this->db->PageExecute($sql, $page->limit, $page->page);
$page->Items($rs->_maxRecordCount);
$this->pagination = $page->show();
} else {
$rs = $this->db->Execute($sql);
}
$this->free_result();
$data = $rs->GetArray();
///array_walk($data,'dbConvert');
return $data;
}
示例7: wp_ulike_bbpress_likes_logs
/**
* Create WP ULike bbPress Logs page with separate pagination
*
* @author Alimir
* @since 2.2
* @return String
*/
function wp_ulike_bbpress_likes_logs()
{
global $wpdb;
$alternate = true;
$items = $wpdb->get_var("SELECT COUNT(*) FROM " . $wpdb->prefix . "ulike_forums");
if ($items > 0) {
$p = new pagination();
$p->items($items);
$p->limit(wp_ulike_logs_return_per_page());
// Limit entries per page
$p->target("admin.php?page=wp-ulike-bbpress-logs");
$p->calculate();
// Calculates what to show
$p->parameterName('page_number');
$p->adjacents(1);
//No. of page away from the current page
if (!isset($_GET['page_number'])) {
$p->page = 1;
} else {
$p->page = $_GET['page_number'];
}
//Query for limit page_number
$limit = "LIMIT " . ($p->page - 1) * $p->limit . ", " . $p->limit;
$get_ulike_logs = $wpdb->get_results("SELECT * FROM " . $wpdb->prefix . "ulike_forums ORDER BY id DESC " . $limit . "");
?>
<div class="wrap">
<h2><?php
_e('WP ULike Logs', 'alimir');
?>
</h2>
<h3><?php
_e('Topics Likes Logs', 'alimir');
?>
</h3>
<div class="tablenav">
<div class='tablenav-pages'>
<span class="displaying-num"><?php
echo $items . ' ' . __('Logs', 'alimir');
?>
</span>
<?php
echo $p->show();
// Echo out the list of paging.
?>
</div>
</div>
<table class="widefat">
<thead>
<tr>
<th width="2%"><?php
_e('ID', 'alimir');
?>
</th>
<th width="10%"><?php
_e('Username', 'alimir');
?>
</th>
<th><?php
_e('Status', 'alimir');
?>
</th>
<th width="6%"><?php
_e('Topic ID', 'alimir');
?>
</th>
<th><?php
_e('Topic Title', 'alimir');
?>
</th>
<th width="20%"><?php
_e('Date / Time', 'alimir');
?>
</th>
<th><?php
_e('IP', 'alimir');
?>
</th>
<th><?php
_e('Actions', 'alimir');
?>
</th>
</tr>
</thead>
<tbody class="wp_ulike_logs">
<?php
foreach ($get_ulike_logs as $get_ulike_log) {
?>
<tr <?php
if ($alternate == true) {
echo 'class="alternate"';
}
?>
>
//.........这里部分代码省略.........
示例8: url
//.........这里部分代码省略.........
print '<input type="checkbox" name="track_coupons" id="track_coupons" ' . $coupon_track . '>';
?>
<img class="help_tip" width="16" height="16" data-tip='<?php
_e('Tracks all coupons that were applied to abandoned carts', 'woocommerce');
?>
' src="<?php
echo plugins_url();
?>
/woocommerce/assets/images/help.png" /></p>
<!-- <span class="description"><?php
_e('Tracks all coupons that were applied to abandoned carts', 'woocommerce-ac');
?>
</span> -->
</td>
</tr>
</table>
</div>
</div>
</div>
<p class="submit">
<input type="submit" name="Submit" class="button-primary" value="<?php
esc_attr_e('Save Changes', 'woocommerce-ac');
?>
" />
</p>
</form>
</div>
<?php
} elseif ($action == 'listcart' || $action == '') {
?>
<p> <?php
_e('The list below shows all Abandoned Carts which have remained in cart for a time higher than the "Cart abandoned cut-off time" setting.', 'woocommerce-ac');
?>
</p>
<?php
//echo plugins_url();
include_once "pagination.class.php";
/* Find the number of rows returned from a query; Note: Do NOT use a LIMIT clause in this query */
$wpdb->get_results("SELECT wpac . * , wpu.user_login, wpu.user_email \n\t\t\t\t\t FROM `" . $wpdb->prefix . "ac_abandoned_cart_history` AS wpac \n\t\t\t\t\t LEFT JOIN " . $wpdb->prefix . "users AS wpu ON wpac.user_id = wpu.id\n\t\t\t\t\t WHERE recovered_cart='0' AND unsubscribe_link='0' ");
$count = $wpdb->num_rows;
if ($count > 0) {
$p = new pagination();
$p->items($count);
$p->limit(10);
// Limit entries per page
$p->target("admin.php?page=woocommerce_ac_page&action=listcart");
if (isset($p->paging)) {
if (isset($_GET[$p->paging])) {
$p->currentPage($_GET[$p->paging]);
}
// Gets and validates the current page
}
$p->calculate();
// Calculates what to show
$p->parameterName('paging');
$p->adjacents(1);
//No. of page away from the current page
$p->showCounter(true);
if (!isset($_GET['paging'])) {
$p->page = 1;
} else {
$p->page = $_GET['paging'];
}
示例9: sc_render_manager_page
//.........这里部分代码省略.........
}
break;
case 'upload':
?>
<form action="" enctype="multipart/form-data" method="post" id ="add_track">
<table class="form-table">
<tr valign="top">
<th scope="row"><label for="track_title">Track title:</label></th>
<td><input type="text" name="track_title" size="30" class="regular-text code"></td>
</tr>
<tr valign="top">
<th scope="row"><label for="track_file">Please specify a track:</label></th>
<td><input type="file" name="track_file" id="track_file" size="40" accept="audio/*" class="regular-text code"></td>
</tr>
<tr valign="top">
<th scope="row"><label for="track_art">Please specify track artwork:</label></th>
<td><input type="file" name="track_art" id="track_art" size="40" accept="image/*" class="regular-text code"></td>
</tr>
<tr valign="top">
<th scope="row"><label for="tag">Track tags:</label></th>
<td><input type="text" name="tag" id="tag" size="30"><input type="button" id="add_tag" name="add_tag" class="button" value="Add Tag" />
<br><ul id="tags"></ul></td>
</tr>
<tr valign="top">
<th scope="row"><label for="sharing">Track privacy:</label></th>
<td><select name="sharing">
<option value="public">Public</option>
<option value="private">Private</option>
</select></td>
</tr>
</table>
<p class="submit"><input type="submit" value="Upload" class="button-primary"></p>
</form>
<?php
try {
$tmp_file = '/tmp/' . stripslashes($_FILES['track_file']['name']);
$tmp_art_file = '/tmp/' . stripslashes($_FILES['track_art']['name']);
if (move_uploaded_file($_FILES['track_file']['tmp_name'], $tmp_file) && move_uploaded_file($_FILES['track_art']['tmp_name'], $tmp_art_file)) {
// upload audio file
$track = json_decode($client->post('tracks', array('track[title]' => $_POST['track_title'], 'track[asset_data]' => '@' . $tmp_file, 'track[artwork_data]' => '@' . $tmp_art_file, 'track[tags]' => strlen($_POST['tags']) ? $_POST['tags'] : null, 'track[sharing]' => $_POST['sharing'])));
unlink(realpath($tmp_file));
unlink(realpath($tmp_art_file));
}
} catch (Services_Soundcloud_Invalid_Http_Response_Code_Exception $e) {
var_dump($e->getMessage());
exit;
}
break;
case 'tracks':
try {
echo '</br>';
$page_size = 5;
// Pagination code
$p = new pagination();
$p->items($me['track_count']);
$p->limit($page_size);
// Limit entries per page
$p->target("admin.php?page=soundcloud-manager&tab=tracks");
$p->currentPage($_GET[$p->paging]);
// Gets and validates the current page
$p->calculate();
// Calculates what to show
$p->parameterName('paging');
$p->adjacents(1);
//No. of page away from the current page
if (!isset($_GET['paging'])) {
$p->page = 1;
} else {
$p->page = $_GET['paging'];
}
if ($p->page == 1) {
// get first page of tracks
$tracks = json_decode($client->get('users/' . $me['id'] . '/tracks', array('order' => 'created_at', 'limit' => $page_size)));
} else {
// get additional pages of tracks
$tracks = json_decode($client->get('users/' . $me['id'] . '/tracks', array('order' => 'created_at', 'limit' => $page_size, 'offset' => $page_size * $page)));
}
?>
<div class="tablenav">
<div class='tablenav-pages'>
<?php
echo $p->show();
?>
</div>
</div>
<?php
foreach ($tracks as $track) {
$client->setCurlOptions(array(CURLOPT_FOLLOWLOCATION => 1));
$embed_info = json_decode($client->get('oembed', array('url' => $track->permalink_url)));
// render the html for the player widget
echo $embed_info->html . '</br></br>';
}
} catch (Services_Soundcloud_Invalid_Http_Response_Code_Exception $e) {
var_dump($e->getMessage());
exit;
}
break;
}
}
示例10: show_easy_gallery
function show_easy_gallery($atts, $content = null)
{
$order = 'desc';
$pagesql = '';
$limit = '';
$count = 8;
$page = true;
$page_st = true;
$theme = 'fancybox';
$view = 'album';
$album = '';
global $wpdb;
//echo "select * from easy_photos order by $order limit $limit offset $offset";
if (isset($atts['order'])) {
$order = $atts['order'];
}
if (isset($atts['theme'])) {
$theme = trim($atts['theme']);
if ($theme != 'fancybox' && $theme != 'swipebox') {
$theme = 'fancybox';
}
}
if (isset($atts['view'])) {
$view = trim($atts['view']);
if ($view != 'album' && $view != 'image') {
$view = 'album';
}
}
if (isset($atts['album'])) {
$album = trim($atts['album']);
}
if (isset($atts['limit'])) {
$count = trim($atts['limit']);
if ($count < 1) {
$count = 2;
}
}
$order = strtolower($order);
if ($order != 'asc' && $order != 'desc') {
$order = 'desc';
}
if (isset($atts['pagination'])) {
$page_st = trim($atts['pagination']);
if ($page_st != 'true' && $page_st != 'false') {
$page_st = 'true';
}
}
if ($page_st == 'true') {
$page = true;
$sql = " SELECT DISTINCT(a.album_id) FROM easy_album a,easy_photos b WHERE a.album_id=b.album_id AND a.disabled=0 AND b.disabled=0";
if ($album != '') {
$sql = $sql . " and a.album_id = {$album}";
}
if ($view == 'image') {
$sql = "select * from easy_photos where album_id not in(select album_id from easy_album b where b.disabled=1) and disabled=0";
if ($album != '') {
$sql = $sql . " and album_id = {$album}";
}
}
$rows = $wpdb->get_results($sql);
$items = count($rows);
if ($items > 0) {
$p = new pagination();
$p->items($items);
$p->limit($count);
// Limit entries per page
if ($album != '') {
$p->target(get_permalink() . '?album=' . $album);
} else {
$p->target(get_permalink());
}
//$p->urlFriendly();
if (isset($p->paging)) {
$p->currentPage($_GET[$p->paging]);
}
// Gets and validates the current page
$p->calculate();
// Calculates what to show
$p->parameterName('paging');
$p->nextLabel('');
//removing next text
$p->prevLabel('');
//removing previous text
$p->nextIcon('►');
//Changing the next icon
$p->prevIcon('◄');
//Changing the previous icon
$p->adjacents(1);
//No. of page away from the current page
if (!isset($_GET['paging'])) {
$p->page = 1;
} else {
$p->page = $_GET['paging'];
}
//Query for limit paging
$limit = "LIMIT " . ($p->page - 1) * $p->limit . ", " . $p->limit;
} else {
echo "No Images";
}
} else {
//.........这里部分代码省略.........
示例11: count
function sql_page($sql, $limit = 20)
{
$db = get_instance()->db;
$rs = preg_replace("/select(.*)from/is", "select count(users.id) total from", $sql);
$q = $db->query($rs)->row_array();
$this->sql_page_total = $q['total'];
// $this->sql_page_total = $db->query($sql)->num_rows();
$this->load->library('pagination');
$page = new pagination();
$page->target(preg_replace('/([&?]+page=[0-9]+)/i', '', $_SERVER['REQUEST_URI']));
$page->limit($limit);
@$page->currentPage($_GET['page']);
$page->Items($this->sql_page_total);
$this->sql_pagination = $page->show();
$c_page = $page->page == 1 ? 0 : ($page->page - 1) * $page->limit;
return $db->query($sql . ' limit ' . $c_page . ',' . $page->limit)->result();
}
示例12:
$index++;
}
}
}
}
?>
<!--Pagination Start-->
<?php
if (!empty($buildings)) {
?>
<div class="row">
<div class="col-xs-12 text-center">
<nav>
<?php
$pag->show();
?>
</nav>
</div>
</div>
<?php
}
?>
<!--Pagination End-->
</div>
<div class="tab-pane fade active in" id="mapview">
<br/>
<?php
示例13: pagination
function detail_page($detail)
{
$page = 0;
if (@$_GET["page"]) {
$page = $_GET["page"] - 1;
}
$foo = @split("<!-- pagebreak -->", $detail);
$target = preg_replace("/([&?]+page=[0-9]+)/i", "", $_SERVER["REQUEST_URI"]);
$pagination = new pagination();
$pagination->target($target);
$pagination->limit(1);
@$pagination->currentPage($_GET["page"]);
$pagination->Items(count($foo));
return @$foo[$page] . $pagination->show();
}
示例14: list_voucher_display_settings
function list_voucher_display_settings()
{
global $wpdb;
$sql = 'SELECT COUNT(*) FROM wp_voucher_post';
$items = $wpdb->get_var($sql);
// $items = mysql_num_rows(mysql_query("SELECT * FROM wp_voucher_post")); // number of total rows in the database
if ($items > 0) {
$p = new pagination();
$p->items($items);
$p->limit(500);
// Limit entries per page
$p->target("admin.php?page=list_voucher_settings");
$p->currentPage($_GET[$p->paging]);
// Gets and validates the current page
$p->calculate();
// Calculates what to show
$p->parameterName('paging');
$p->adjacents(1);
//No. of page away from the current page
if (!isset($_GET['paging'])) {
$p->page = 1;
} else {
$p->page = $_GET['paging'];
}
//Query for limit paging
$limit = "LIMIT " . ($p->page - 1) * $p->limit . ", " . $p->limit;
} else {
echo "No Record Found";
}
echo '<div class="wrap">
<h2>List of Records</h2>
<div class="tablenav">
<div class="tablenav-pages">';
echo $p->show();
echo '</div>
</div>
<table class="widefat">
<thead>
<tr>
<th><strong>ID</strong></th>
<th><strong>Người nhận</strong></th>
<th><strong>Email</strong></th>
<th><strong>Điện thoại</strong></th>
<th><strong>Tên voucher</strong></th>
<th><strong>Số lượng</strong></th>
</tr>
</thead>
<tbody>';
$sql = "SELECT * FROM wp_voucher_post, wp_posts where wp_voucher_post.post_id = wp_posts.id ORDER BY wp_voucher_post.id DESC {$limit}";
$result = $wpdb->get_results($sql) or die('Error, query failed');
foreach ($result as $value) {
echo '<tr>
<td>' . $value->post_id . '</td>
<td>' . $value->fullname . '</td>
<td>' . $value->email . '</td>
<td>' . $value->phone . '</td>
<td>' . $value->post_title . '</td>
<td>' . $value->total . '</td>
</tr>';
}
echo '</tbody>
</table>
</div>';
}
示例15:
<h2><?php
_e('Gerenciar vendas');
?>
</h2>
<form action="admin-post.php" id="modulo-vendas-realizadas" method="post"><?php
wp_nonce_field('modulo_venda_transacao');
?>
<input type="hidden" name="action" value="modulo_venda_transacao">
<p>Itens encontrados: <?php
echo $items;
?>
</p>
<div class="tablenav">
<div class="tablenav-pages">
<?php
echo $p->show();
// Echo out the list of paging.
?>
</div>
<fieldset class="alignleft" id="modulo-pagamento-acoes">
<legend>Ações e filtros</legend>
<input type="submit" value="Apagar"
name="modulo_venda_transacao" class="button-secondary delete" />
<select name="modulo-venda-status" id="status" class= "postform">
<option value="todos">Todos</option>
<option value="pendente">Pendente</option>
<option value="aguardando_pagamento">Aguardando Pagamento</option>
<option value="enviando">Enviando</option>
<option value="finalizado">Finalizado</option>
</select>
<input type="submit" id="post-query-status" value="Modificar Status" name="modulo_venda_transacao"