Pear Pager Page class is a very useful PHP paging class, extensibility is very strong, able to adapt to the needs of various paging situation, at least I have a few years of large and small projects, basically no extra code for pagination, all are used pager, This is the pager of usability. The following code looks at its use example:Example 1PLAIN TEXTPhp:
req
Overviewthrough the analysis of the previous article, we know where the pager module is located throughout SQLite. It is the core module of SQLite, which plays a number of important roles. As a transaction manager, it implements the acid characteristics of transactions through concurrency control and failback, is responsible for the atomic commit and rollback of transactions, as a page manager, it handles reading and writing data pages from a file, an
action, but this is not the focus of our consideration ). After paging, we only take the objects corresponding to the user request page. To maximize code reuse, I have done the following:
1. Create a new pager class with int attributes such as beginpage, endpage, currentpage, pagesize, and total, it represents the start page, end page, current page, number of records on each page, and total number of records, which are mainly used for displaying pa
How to use:
First add the Mvcpager.dll reference to the MVC project.
Front Code
Front desk:
@{Layout = null; @using Webdiyer.WebControls.Mvc @model pagedlist
Background code
Using System;
Using System.Collections.Generic;
Using System.Linq;
Using System.Web;
Using SYSTEM.WEB.MVC;
Using WEBDIYER.WEBCONTROLS.MVC;
Namespace Mvcapplication6.controllers
{public
class Homecontroller:controller
{
////Get
: /home/public
actionresult Index (int pageindex=1, int pagesize=2)
{
list
number displayed per page is required, two basic parameters, currentPage and pageSize, are required;
To query the table content, you need a form with the query conditions;
Because you need to modify and delete and remember the current page, a flag is required to indicate the operation type currently in progress;
To make our program more flexible, add the iner to be loaded after obtaining data, and add pager to be loaded by the paging control,
The det
Paging class, which is used only to process data structures and is not responsible for working with the display
Class Pager
{
var $PageSize; Number of pages per page
var $CurrentPageID; Current number of pages
var $NextPageID; Next page
var $PreviousPageID; Previous page
var $numPages; Total pages
var $numItems; Total Record Count
var $isFirstPage; Whether the first page
var $isLastPage; Whether
structures and is not responsible for working with the display
Class Pager
{
var $PageSize; Number of pages per page
var $CurrentPageID; Current number of pages
var $NextPageID; Next page
var $PreviousPageID; Previous page
var $numPages; Total pages
var $numItems; Total Record Count
var $isFirstPage; Whether the first page
var $isLastPage; Whether the last page
var $sql; SQL query Statements
function Pager
FileType indent on
"Loading related indentation files for a specific file type
Set viminfo+=!
"Save Global variables
Set Nobackup
"Prohibit generation of temporary files
Vmap
"+y" in the selected state Ctrl + C copy
"My status line displays the contents (including file type and decoding)Set statusline=%f%m%r%h%w\ [format=%{ff}]\ [type=%y]\ [pos=%l,%v][%p%%]\ %{strftime (\"%d/%m/%y\-\%h:%m\")}"Set Statusline=[%
Because our company's products involve a lot of table data display, and each table has a large number of fields, in the course of work (several colleagues' efforts ), A set of self-considered lightweight solutions to display table data involves some things, such as field display hiding, data status, paging, and so on.
Because our company's products involve a lot of table data display, and each table has a large number of fields, in the course of work (several colleagues' efforts ), integrate a s
Displaying table data involves some things, such as field display hiding, data status, and paging.
Because our company's products involve a lot of table data display, and each table has a large number of fields, in the course of work (several colleagues' efforts ), integrate a set of self-considered lightweight solutions.
The plug-ins involved mainly include:JQuery. columnmanager. expand. js (Extended columnmanager)JQuery. dropbox. js (self-written)JQuery. p
)) {
$page _string. = ' next page | last ';
}
else{
$page _string. = ' next page | last ';
}
Get data to return results in two-dimensional array format
if ($amount) {
$sql = "SELECT * from table ORDER BY id desc limit". ($page-1) * $page _size. ", $page _size";
$result = mysql_query ($sql);
while ($row = Mysql_fetch_row ($result)) {
$rowset [] = $row;
}
}else{
$rowset = Array ();
}
There is no code to display t
equals the total amount of data divided by the result of each page } } else{ $page _count = 0;}
Page link$page _string = ";if ($page = = 1) {$page _string. = ' first page | prev | ';}else{$page _string. = ' first page | prev | ';}if ($page = = $page _count) | | ($page _count = = 0)) {$page _string. = ' next page | last ';}else{$page _string. = ' next page | last ';}Get data to return results in two-dimensional array formatif ($amount) {$sql = "SELECT * from table ORDER BY id desc limit". ($pa
Displaying table data involves some things, such as field display hiding, data status, and paging.
Because our company's products involve a lot of table data display, and each table has a large number of fields, in the course of work (several colleagues' efforts ), integrate a set of self-considered lightweight solutions.
The plug-ins involved mainly include:JQuery. columnmanager. expand. js (Extended columnmanager)JQuery. dropbox. js (self-written)JQuery. p
the Pear DB Class
FileName:Pager.class.php
Pagination class, which is used only to work with data structures, and is not responsible for working with the display
Class Pager
{
var $PageSize; Number of pages per page
var $CurrentPageID; Current number of pages
var $NextPageID; Next page
var $PreviousPageID; Previous page
var $numPages; Total pages
var $numItems; Total number of records
var $isFirstPage; is the first page
var $isLastPage; is the last p
structure, not to handle the work displayed class Pager { var $PageSize;//number of per page var $CurrentPageID;//Current pages var $ next: Php to implement the first page automatically select the language jump ID;//Next page var $Previ Ouspageid; Previous Var $numPages//Total number of pages Var $numItems;//Total Records Var $isFirstPage//Whether first page Var $is previous page: XML-RPC for PHP and Java Solutions to Chinese problems; Wheth
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.