Home  >  Article  >  Backend Development  >  Class Pagination_PHP Tutorial

Class Pagination_PHP Tutorial

WBOY
WBOYOriginal
2016-07-13 17:27:13973browse

9: 10: class Page { 11: var $firstRow = 0; // Starting row 12: var $listRows = 0; // Number of list rows displayed per page 13: var $parameter = ""; // Parameters to be taken when page jumps 14: var $totalPages = 0; // Total number of pages 15: var $totalRows = 0; // Total number of rows 16: var $nowPage = 0; // Current page number 17: var $showPageJump = True; //Whether to display the page to jump to18: var $coolPages = 0; //The total number of pages in the paging column19: var $rollPage = 5; //The number of pages displayed on each page of the paging column20 : twenty one: /*--------------------------------------------- ----------------------------- 22: Function: Display paging information Page x of x >> 23: - -------------------------------------------------- --------------------------*/ 24: function prompt() { 25: if(0 == $this->totalRows) { 26 : return; 27: } 28: $this->totalPages=ceil($this->totalRows/$this->listRows); //Total number of pages 29: $this->coolPages = ceil($this->totalPages/ $this->rollPage); 30: if ( $this->firstRow >= $this->totalRows ) { // 2003-12-30 17:18:29 kinger modified 31: $this->nowPage = $this- >totalPages; 32: $this->firstRow = ($this->totalPages-1)*$this->listRows; 33: } else { 34: $this->nowPage=floor($this->firstRow/$this ->listRows+1); //Current page number 35: } 36: $nowCoolPage = ceil($this->nowPage/$this->rollPage); 37: 38: // >> 39: if( $nowCoolPage == 1){ 40: $theFirst = ""; 41: $prePage = ""; 42: }else{ 43: $preRow = ($this->rollPage*($nowCoolPage-1)-1)* $this->listRows; 44: $prePage = "totalRows&$this->parameter>parameter>coolPages){ 48: $nextPage = ""; 49: $theEnd=""; 50: }else { 51: $nextRow = ($nowCoolPage*$this->rollPage)*$this->listRows; 52: $theEndRow = ($this->totalPages-1)*$this->listRows; 53: $nextPage = " totalRows&$this->parameter>>"; 54: $theEnd = "totalRows&$this->parameter>>>"; 55: } 56: // 1 2 3 4 5 57: $linkPage = ""; 58: for ($i=1;$irollPage;$i++){ 59: $page=($nowCoolPage-1)*$this->rollPage+$i; 60: $rows=($page-1)*$ this->listRows; 61: if($page!=$this->nowPage){ 62: if($pagetotalPages){ 63: $linkPage .= " totalRows&$this->parameter>".$page .""; 64: }else{ 65: break; 66: } 67: }else{ 68: if($this->totalPages != 1){ 69: $linkPage .= " [".$page ."

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/531891.htmlTechArticle9: 10: class Page { 11: var $firstRow = 0; // Starting row 12: var $ listRows = 0 ; // Number of list rows displayed on each page 13: var $parameter = ; // Parameters to be taken when jumping to the page 14: var $total...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn