程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> 網頁編程 >> PHP編程 >> 關於PHP編程 >> 結合 thinkPHP 分頁寫成自己分頁類

結合 thinkPHP 分頁寫成自己分頁類

編輯:關於PHP編程



<?

 (); 

 ; 
     ; 
     ; 
     ; 
     ; 
     ;  
     ; 
     ;
     ;
      = ;  
    
      = '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[] = 
     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 +  -1

        ->startPage = (->pageMax -  + 1, ->startPage); 
        ->startPage = (->startPage, 1);
         
        ->endPage = ->startPage +  -1->endPage = (->pageMax, ->endPage); 
         
        ['startPage'] = ->startPage; 
         
        (->page <= 1){
             = '<span>'.->config['first'].'</span>' = '<span>'.->config['prev'].'</span>' = "<span><a href='&->varPage=1'>".->config['first'].'</a>' = "<span><a href='&->varPage=->prevPage'>".->config['prev'].'</a>'(->page >= ->pageMax){ 
             = '<span>'.->config['next'].'</span>' = '<span>'.->config['last'].'</span>' = "<a href='&->varPage=->pageMax'>".->config['last'].'</a>' = "<a href='&->varPage=->nextPage'>".->config['next'].'</a>'(){ 
            (->nextPage >= ->pageMax)?  = '' : ->prevPage < 1)?  = '' : ( = ->startPage;  <= ->endPage; ++ (->page ==  .= "<a class='current' href='&->varPage='></a>"
                 .= "<a href='&->varPage='></a>" = ('%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?>
 <style>,span{ margin:.{ color:</style>

 



 

  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved