一個快速好用的php分頁類

來源:互聯網
上載者:User
[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;$Tmpa<=$this->totalpage;$Tmpa++){ if($Tmpa+$this->stride<$this->currentpage){//加了跨度還小於當前頁的不顯示 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

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.