php 快速分页,一个快速好用的php分页类

[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->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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值