类分页_PHP教程
程序员文章站
2024-04-04 23:56:00
...
9: 10: class Page { 11: var $firstRow = 0 ; // 起始行 12: var $listRows = 0 ; // 每页显示列表行数 13: var $parameter = ""; // 页数跳转时要带的参数 14: var $totalPages = 0 ; // 总页数 15: var $totalRows = 0 ; // 总行数 16: var $nowPage = 0 ; // 当前页数 17: var $showPageJump = True; // 是否显示跳到第几页 18: var $coolPages = 0 ; // 分页的栏的总页数 19: var $rollPage = 5; // 分页栏每页显示的页数 20: 21: /*-------------------------------------------------------------------------- 22: 功能:显示分页信息第 x 页 共 x 页 >> 23: -----------------------------------------------------------------------------*/ 24: function prompt() { 25: if(0 == $this->totalRows) { 26: return; 27: } 28: $this->totalPages=ceil($this->totalRows/$this->listRows); //总页数 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); //当前页号 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."
推荐阅读
-
PHP获取汉字的拼音(全部与首字母)(转载),php汉字_PHP教程
-
类分页_PHP教程
-
yiic命令时提示“php.exe”不是内部或外部命令的解决方法,yiicphp.exe_PHP教程
-
facebook工具xhprof的安装与使用-分析php执行性能_PHP教程
-
PHP缓存技术的多种方法小结,php缓存小结_PHP教程
-
php5.3不能连接mssql数据库的解决方法,php5.3mssql_PHP教程
-
php面向对象(OOP)编程完整教程,面向对象oop_PHP教程
-
php 字符过滤类,用于过滤各类用户输入的数据_PHP
-
面向对象设计原则 php面向对象全攻略 (十七) 自动加载类
-
Windows下安装PHP单元测试环境PHPUnit图文教程,