一個快速好用的php分頁類

WBOY
發布: 2016-07-25 09:10:35
原創
929 人瀏覽過
[code]

totalpage=$objpage; } //设置当前页 function setCurrentpage($objpage=1){ $this->currentpage=$objpage; } //设置跨度 function setStride($objStride=1){ $this->stride=$objStride; } //获得总页数 function getTotalpage(){ return $this->totalpage; } //获得跨读 function getStride($objStride=1){ return $this->stride; } //获取当前页 function getCurrentpage($objpage=1){ return $this->currentpage; } //打印分页 public function Pageprint(){ for($Tmpa=1;$Tmpatotalpage;$Tmpa++){ if($Tmpa+$this->stridecurrentpage){//加了跨度还小于当前页的不显示 continue; } if($Tmpa+$this->stride==$this->currentpage){//刚好够跨度的页数 $p=$this->currentpage-1; $willprint.="首页 上一页 "; } if($Tmpa>$this->currentpage+$this->stride){//大于当前页+跨度的页面 break; } $willprint.="[$Tmpa]"; if($Tmpa==$this->currentpage+$this->stride){//刚好够跨度的页数 $p=$this->currentpage+$this->stride+1; $willprint.="下一页 totalpage">末页"; } } echo $willprint; } }

class cut_page extends Page { var $filename; var $showtotal; function __construct($filename){ $this->cachefile = $filename; $this->showtotal = "yes"; } public function filename(){ if (file_exists($this->cachefile)){ return 1; } else return 0; } private $type; public function typelist($typeid){ $this->type = $typeid; $fp = fopen($this->cachefile,"rb"); $str= fread($fp,filesize($this->cachefile)); //echo $this->type."
"; //分类ID $arr= explode("::",$str);

for ($i=0;$itype){ //return $arr2[1]; if(isset($_GET



來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
最新問題
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板
關於我們 免責聲明 Sitemap
PHP中文網:公益線上PHP培訓,幫助PHP學習者快速成長!