当前位置:Gxlcms > PHP教程 > 结合thinkPHP分页写成自己分页类_PHP教程

结合thinkPHP分页写成自己分页类_PHP教程

时间:2021-07-01 10:21:17 帮助过:10人阅读




// +----------------------------------------------------------------------
// $Id: page.class.php  2013-05-26 00:08:49

 (); 

 ; 
     ; 
     ; 
     ; 
     ; 
     ;  
     ; 
     ;
     ;
      = ;  
    
      = 'header'=>'条记录','prev'=>'上一页','next'=>'下一页','first'=>'首页','last'=>'尾页',
        'theme' => '%records% %header% %page%/%pageMax% 页  %firstPage%%prevPage%%linkPage%%nextPage%%lastPage%'
     
     __construct(, ,  = 'p',  = ->records = ->pageMax = (/->page= (([]), 1); 
        ->page = (->page, ->pageMax); 
        ->nextPage = ->page + 1->prevPage = ->page - 1->varPage = ; 
        ->parameter = ; 

     setConfig(, ((->config[->config[] = 输出
     +----------------------------------------------------------
     * @param  $length 分页条长度
     +----------------------------------------------------------
     * @param  $hide 是否适时隐藏上、下一页,比如:当前是第一页,则隐藏上一页
     +----------------------------------------------------------
     
     show(,  = (0 == ->records)  ''(->url)? ->url = ['REQUEST_URI'] :  = ->url.((->url,'?')?'':'?').-> = (((['query'(['query'],([-> = ['path'].'?'.(('mid' == ->style){ 
            ( % 2 != 0 = ( / 2 =  - 1 ;
            } =  =  / 2 = - 1;  
            ->startPage = (->page  + ) > ->pageMax ? ->pageMax  -  : ->page - ->endPage = (->page < )?  : ->page + { 
            ->startPage = (->page >= )? ['startPage'] : 1->endPage  = ->startPage +  - 1->lastPage =  (['lastPage'])? ['lastPage'] : 1; 
            ['lastPage'] = ->page;  
             
            (->lastPage < ->page){ 
                (->page >= ->->startPage = ['startPage'] = ->->endPage = ->startPage +  -1(->lastPage == ->page){
                (->page == ->->startPage = ['startPage'] = ->->endPage = ->startPage +  -1->startPage = ['startPage'] = ->page -  + 1->endPage = ->startPage +  -1{
                (->page == ->->startPage = ['startPage'] = ->page -  + 1->endPage = ->startPage +  -1startPage.'
'; //echo '上次页码:'. $this->lastPage.'
';
->startPage = (->pageMax - + 1, ->startPage); ->startPage = (->startPage, 1); ->endPage = ->startPage + -1->endPage = (->pageMax, ->endPage); ['startPage'] = ->startPage; startPage.'
'; //echo '上次页码:'. $this->lastPage.'
';
(->page <= 1){ = ''.->config['first'].'' = ''.->config['prev'].'' = "&->varPage=1'>".->config['first'].'' = "&->varPage=->prevPage'>".->config['prev'].''(->page >= ->pageMax){ = ''.->config['next'].'' = ''.->config['last'].'' = "&->varPage=->pageMax'>".->config['last'].'' = "&->varPage=->nextPage'>".->config['next'].''(){ (->nextPage >= ->pageMax)? = '' : ->prevPage < 1)? = '' : ( = ->startPage; <= ->endPage; ++ (->page == .= "&->varPage='>" .= "&->varPage='>" = ('%records%','%header%','%page%','%pageMax%','%firstPage%','%prevPage%','%linkPage%','%nextPage%','%lastPage%' = (->records,->config['header'],->page,->pageMax,,,,, = (, , ->config['theme' = Page(340, 10 = '%records% %header% %page%/%pageMax% 页 %firstPage%%prevPage%%linkPage%%nextPage%%lastPage%'->setConfig('theme',); ->setConfig('last','末页'); ->url = 'http://localhost/test.php' ->show(10?>



www.bkjia.comtruehttp://www.bkjia.com/PHPjc/440334.htmlTechArticle? (); ; ; ; ; ; ; ; ; ; = ; = 'header'='条记录','prev'='上一页','next'='下一页','first'='首页','last'='尾页', 'theme' = '%records% %header% %page%/%pageMax% 页 %first...

人气教程排行