本文整理汇总了PHP中pagination::limit方法的典型用法代码示例。如果您正苦于以下问题:PHP pagination::limit方法的具体用法?PHP pagination::limit怎么用?PHP pagination::limit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pagination
的用法示例。
在下文中一共展示了pagination::limit方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: defaultAction
function defaultAction()
{
$db = new sql();
$db->connect();
$chid = $this->chid;
include "lib/pagination.class.php";
include "lib/orderby.class.php";
$adminConfig = admin::adminConfig();
$orderBy = new orderBy("?chid=" . $this->chid . "&", array("library" => "№", "time" => "Дата", "name" => "Заголовок", "short_text" => "Подзаголовок", "author" => "Автор"), array("library" => "desc"), $this->field, $this->order);
$pagination = new pagination($orderBy->urlForPage(), $this->page, $adminConfig["recPerPage"], '', "library", "id");
$res = $db->query("select library.id as library, name, short_text, time, authors.lastname as author FROM (library LEFT JOIN library_authors ON library.id = library_authors.library) LEFT JOIN authors ON library_authors.author = authors.id GROUP BY library.id" . $orderBy->orderByQuery() . " " . $pagination->limit());
$page = $this->page ? "&page=" . $this->page : "";
while ($data = $db->fetch_array($res)) {
$res1 = $db->query("select id, firstname, secondname, lastname from library_authors left join authors on library_authors.author = authors.id where library_authors.library=" . $data["library"] . " order by lastname, firstname, secondname");
$typeAuthorsID = admin::getTypeID("authors");
while ($data1 = $db->fetch_array($res1)) {
$data["fio"] .= "<li><a href=\"?chid={$typeAuthorsID}&action=edit&id={$data1['id']}\">" . $data1["lastname"] . ($data1["firstname"] ? " " . $data1["firstname"] : "") . ($data1["secondname"] ? " " . $data1["secondname"] : "") . "</a></li>";
}
$data["date"] = $data["time"] ? @date("d.m.Y", $data["time"]) : "";
$data["fio"] = $data["fio"] ? "<ul>" . $data["fio"] . "</ul>" : "";
eval('$libraryTR.="' . admin::template("libraryTR") . '";');
}
$pageBar = $pagination->bar();
$th = $orderBy->bar();
eval('$content="' . admin::template("libraryMain") . '";');
$this->elements["content"] = $content;
}
示例2: defaultAction
function defaultAction()
{
$db = new sql();
$db->connect();
$chid = $this->chid;
include "lib/pagination.class.php";
include "lib/orderby.class.php";
$adminConfig = admin::adminConfig();
for ($i = 1; $i < 4; $i++) {
$voteTR = "";
$orderBy = new orderBy("?chid=" . $this->chid . "&", array("id" => "№", "time" => "Дата", "name" => "Заголовок", "company" => "Компания", "gsum" => "Средний бал", "gcount" => "Проголосовало"), array("gsum" => "desc"), $this->field[$i], $this->order[$i], array("field[{$i}]", "order[{$i}]"));
$pagination = new pagination($orderBy->urlForPage(), $this->page, $adminConfig["recPerPage"], '', "projects", "id");
$res = $db->query("select projects.id, name, company, category_name, date, sum(IF(grade is null,0, grade))/count(IF(grade is null,0, grade)) as gsum, count(grade) as gcount FROM (projects LEFT JOIN categories ON projects.category = categories.category_id) left join votes on projects.id=votes.id where category={$i} group by projects.id, name, company, category_name, date " . $orderBy->orderByQuery() . " " . $pagination->limit());
$page = $this->page ? "&page=" . $this->page : "";
while ($data = $db->fetch_array($res)) {
$data["date"] = date("d.m.Y", $data["date"]);
eval('$voteTR.="' . admin::template("voteTR") . '";');
}
$pageBar = $pagination->bar();
$th = $orderBy->bar();
eval('$content.="' . admin::template("voteMain") . '";');
$content .= "<br>";
}
$this->elements["content"] = $content;
}
示例3: 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();
}
示例4: 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();
}
示例5: 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();
}
示例6: defaultAction
function defaultAction()
{
$db = new sql();
$db->connect();
$chid = $this->chid;
include "lib/pagination.class.php";
$adminConfig = admin::adminConfig();
$pagination = new pagination("?chid=" . $this->chid . "&", $this->page, $adminConfig["recPerPage"], '', "news", "id");
$res = $db->query("select id, time, title from news order by id desc " . $pagination->limit());
$page = $this->page ? "&page=" . $this->page : "";
while ($data = $db->fetch_array($res)) {
$data["date"] = $data["time"] ? @date("d.m.Y", $data["time"]) : "";
eval('$newsTR.="' . admin::template("newsTR") . '";');
}
$pageBar = $pagination->bar();
eval('$content="' . admin::template("newsMain") . '";');
$this->elements["content"] = $content;
}
示例7: 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 {
//.........这里部分代码省略.........
示例8: pagination
';
if ($total > 0) {
//постраничная разбивка
$page_href = $mod_page;
if ($search_username) {
$page_href .= "&search_username=" . $search_username;
}
if ($search_status) {
$page_href .= "&search_status=" . $search_status;
}
if ($search_date) {
$page_href .= "&search_date=" . $search_date;
}
$pg = new pagination();
$pg->Items($total);
$pg->limit($pnum);
$pg->target($page_href);
$pg->currentPage($page);
$pg->nextT = ' <a href="[+link+]">' . $langTxt['next'] . '</a> ';
$pg->prevT = ' <a href="[+link+]">' . $langTxt['prev'] . '</a> ';
$pager = $pg->getOutput();
//Данные заказов
$data_query = $modx->db->query("SELECT shk.id, shk.short_txt, shk.price, shk.currency, shk.note, shk.status, shk.userid, DATE_FORMAT(shk.date,'%d.%m.%Y %k:%i') AS date, DATE_FORMAT(shk.sentdate,'%d.%m.%Y %k:%i') AS sentdate " . $data_q . $orderby_q);
//$data_query = $modx->db->select("id, short_txt, price, currency, note, status, userid, DATE_FORMAT(date,'%d.%m.%Y %k:%i') AS date, DATE_FORMAT(sentdate,'%d.%m.%Y %k:%i') AS sentdate", $shkm->mod_table, "", "id DESC", "$start,$pnum");
//Данные пользователей
$userData_query = $modx->db->select("DISTINCT wu.id, wu.username", $dbprefix . "web_users wu, {$shkm->mod_table} shk", "wu.id = shk.userid", "", "");
$users_id_list = "0";
while ($userData = mysql_fetch_row($userData_query)) {
$userName[$userData[0]] = $userData[1];
$users_id_list .= "," . $userData[0];
}
示例9: pagination
$items = mysql_num_rows(mysql_query("SELECT * from {$table_name} where status='{$filtrar_por}'"));
// number of total rows in the database
}
if ($items > 0) {
if ($filtrar_por == 'todos') {
$filtrar_por = false;
}
if ($ordenar_por) {
$ordenar_query = "&ordenar_por=" . $ordenar_por;
}
if ($filtrar_por) {
$filtrar_query = "&filtrar_por=" . $filtrar_por;
}
$p = new pagination();
$p->items($items);
$p->limit(30);
// Limit entries per page
$p->currentPage($_GET[$p->paging]);
// Gets and validates the current page
// Calculates what to show
$p->parameterName('paging');
$p->adjacents(1);
//No. of page away from the current page
$p->target("tools.php?page=" . plugin_basename(dirname(__FILE__)) . "/modulo-vendas.php" . $ordenar_query . $filtrar_query);
if (!isset($_GET['paging'])) {
$p->page = 1;
} else {
$p->page = $_GET['paging'];
}
$p->calculate();
//Query for limit paging
示例10: COUNT
}
// Get all testimonials
$sql = $wpdb->prepare("SELECT COUNT(tes.`id`) AS counter\n\t\tFROM `" . LTW_TES_TESTIMONIALS_TABLE . "` AS tes\n\t\tLEFT JOIN `" . LTW_TES_TESTIMONIAL_GROUPS_TABLE . "` AS g ON (g.`id` = tes.`group_id`)\n\t\t" . $ltw_group_sql, array($ltw_group_sql_id));
$ltw_testimonials_count = '';
$ltw_testimonials_count = $wpdb->get_results($sql, ARRAY_A);
/**
* Get all available groups
*
*/
$sql = "SELECT `id`, `group_name`, `page_id`\n\t\tFROM `" . LTW_TES_TESTIMONIAL_GROUPS_TABLE . "`\n\t\tORDER BY `group_name` ASC";
$ltw_tes_group_info = array();
$ltw_tes_group_info = $wpdb->get_results($sql, ARRAY_A);
if ($ltw_testimonials_count[0]['counter'] > 0) {
$p = new pagination();
$p->items($ltw_testimonials_count[0]['counter']);
$p->limit(15);
// Limit entries per page
$p->target("admin.php?page=ltw_manage_testimonials" . $ltw_group_qs);
$p->currentPage(isset($_GET['paging']) == TRUE ? $_GET['paging'] : 0);
// 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
示例11: 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;
}
示例12: create_paginator
function create_paginator($currentpage, $nb_items, $path)
{
require_once ROOT_DIR . '/' . INC_DIR . '/paginator-digg/pagination.php';
$p = new pagination();
$p->items($nb_items);
$p->currentPage($currentpage);
$p->limit(1);
$p->urlFriendly();
$p->target(URL . "/{$path}/page/%");
if ("" === $path) {
$p->target(URL . "/page/%");
}
$p->adjacents(1);
if (!$p->calculate) {
if ($p->calculate()) {
return "<div class=\"{$p->className}\">{$p->pagination}</div>";
}
}
}
示例13: count
if ($_REQUEST['action'] == "delete") {
$albumid = $_REQUEST['albumid'];
$rows_affected = $wpdb->query("delete from easy_album where album_id={$albumid}");
}
}
?>
<?php
$rows = $wpdb->get_results("select *,(select count(id) from easy_photos b where a.album_id=b.album_id ) as no_img from easy_album a");
$items = count($rows);
$limit = '';
if ($items > 0) {
$p = new pagination();
$p->items($items);
$p->limit(12);
// Limit entries per page
$p->target(get_permalink() . 'admin.php?page=easy-gallery-home');
//$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('►');
示例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: count
?>
" id="easy_cvrprv_preview" />
</div><br style="clear:both;" />
</div>
</form>
<br style="clear:both;" />
<?php
if ($albumid != "") {
$rows = $wpdb->get_results("select * from easy_photos where album_id={$albumid}");
$items = count($rows);
if ($items > 0) {
$p = new pagination();
$p->items($items);
$p->limit(5);
// Limit entries per page
$p->target(get_permalink() . "admin.php?page=easy-gallery-home&ac=add&albumid={$albumid}");
//$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('►');