您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

一个翻页类

2025/1/19 7:23:50发布15次查看
翻页
老东西了,不少站点都有这个方法了(今天突然发现以前没用,所以就写了一下)
------------
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;
    }
    //打印分页
    function pageprint(){
        for($tmpa=0;$tmpatotalpage;$tmpa++){
            if($tmpa+$this->stridecurrentpage){//加了跨度还小于当前页的不显示
                continue;
            }
            if($tmpa+$this->stride==$this->currentpage){//刚好够跨度的页数
                $p=$this->currentpage-$this->stride-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;
    }
}
if(isset($_get[page])){
    $page=$_get[page];
}else{
    $page=1;
}
$cc=new page();
$cc->settotalpage(1000);
$cc->setcurrentpage($page);
$cc->setstride(5);
$cc->pageprint();
?>
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product