Copy CodeThe code is as follows:
Class Page {
Number of pages displayed per page in the page bar
Public $rollPage = 6;
The parameters to take when the page jumps
Public $parameter;
Default list shows the number of rows per page
Public $listRows = 20;
Number of start lines
Public $firstRow;
Number of page total pages
protected $totalPages;
Total number of rows
protected $totalRows;
Current page
protected $nowPage;
Total number of pages in the page bar
protected $coolPages;
Pagination Display Customization
protected $config = Array (
' Redirect ' =>false,
' Header ' = ' record ',
' Prev ' = ' prev ',
' Next ' = ' next page ',
' First ' = ' 1 ',
' Last ' and ' The final page ',
' Theme ' = '%uppage%%first%%prepage%%linkpage%%nextpage%%downpage% Total%totalpage% page ');
Default paging variable name
protected $varPage;
/** +---------------------------------------------------------- * Schema function +---------------------------------------------------------- * @access Public +---------------------------------------------------------- * Total number of records $totalRows @param array * @param array $listRows shows the number of records per page * @param the parameters of the array $parameter paging jump +---------------------------------------------------------- */ Public function __construct ($totalRows, $listRows = ', $parameter = ') { $this->totalrows = $totalRows; $this->parameter = $parameter; $this->varpage = C (' Var_page ')? C (' Var_page '): ' P '; if (!empty ($listRows)) { $this->listrows = intval ($listRows); } $this->totalpages = ceil ($this->totalrows/$this->listrows); Total pages $this->coolpages = ceil ($this->totalpages/$this->rollpage); $_get Verification $this->nowpage = intval ($_get[$this->varpage]); $this->nowpage = $this->nowpage > 0? $this->nowpage:1;
Public Function Setconfig ($name, $value) { if (Isset ($this->config[$name])) { $this->config[$name] = $value; } }
/** +---------------------------------------------------------- * Pagination Display output +---------------------------------------------------------- * @access Public +---------------------------------------------------------- */ Public function Show () {
When the total is less than the number of pages displayed if ($this->totalpages <= $this->rollpage) { $start = 1; $end = $this->totalpages; } else{ // if ($this->nowpage <= $this->rollpage-1) { $start = 1; $end = $this->rollpage;
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.