pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

整合Booststrap分頁(yè)樣式和ThinkPHP分頁(yè)類

分頁(yè)類修改內(nèi)容:只涉及到樣子生成部分代碼,在原來(lái)每個(gè)A鏈接前加了li,在返回的樣式字符串前加UL,以適合Boostrap的css文件的定義。 Bootstrap的css文件基本保持原狀,只是加了一個(gè)#

分頁(yè)類修改內(nèi)容:只涉及到樣子生成部分代碼,在原來(lái)每個(gè)A鏈接前加了li,在返回的樣式字符串前加UL,以適合Boostrap的css文件的定義。

Bootstrap的css文件基本保持原狀,只是加了一個(gè)#lastspan的樣式定義。
--------------------------------------------------------------------------------

pagination.css

 

  1. .pagination {  
  2.   margin20px 0;  
  3. }  
  4. .pagination ul {  
  5.   display: inline-block;  
  6.   list-style:none;  
  7.   *displayinline;  
  8.   /* IE7 inline-block hack */  
  9.   
  10.   *zoom: 1;  
  11.   margin-left0;  
  12.   margin-bottom0;  
  13.   -webkit-border-radius: 4px;  
  14.   -moz-border-radius: 4px;  
  15.   border-radius: 4px;  
  16.   -webkit-box-shadow: 0 1px 2px rgba(0000.05);  
  17.   -moz-box-shadow: 0 1px 2px rgba(0000.05);  
  18.   box-shadow: 0 1px 2px rgba(0000.05);  
  19. }  
  20. .pagination ul > li {  
  21.   displayinline;  
  22. }  
  23. .pagination ul > li > a,  
  24. .pagination ul > li > span,  
  25. .pagination #lastspan {  
  26.   floatleft;  
  27.   padding4px 12px;  
  28.   line-height20px;  
  29.   text-decorationnone;  
  30.   background-color#ffffff;  
  31.   border1px solid #dddddd;  
  32.   border-left-width0;  
  33. }  
  34. .pagination ul > li > a:hover,  
  35. .pagination ul > li > a:focus,  
  36. .pagination ul > .active > a,  
  37. .pagination ul > .active > span {  
  38.   background-color#f5f5f5;  
  39. }  
  40. .pagination ul > .active > a,  
  41. .pagination ul > .active > span {  
  42.   color#999999;  
  43.   cursordefault;  
  44. }  
  45. .pagination ul > .disabled > span,  
  46. .pagination ul > .disabled > a,  
  47. .pagination ul > .disabled > a:hover,  
  48. .pagination ul > .disabled > a:focus {  
  49.   color#999999;  
  50.   background-colortransparent;  
  51.   cursordefault;  
  52. }  
  53. .pagination ul > li:first-child > a,  
  54. .pagination ul > li:first-child > span {  
  55.   border-left-width1px;  
  56.   -webkit-border-top-left-radius: 4px;  
  57.   -moz-border-radius-topleft: 4px;  
  58.   border-top-left-radius: 4px;  
  59.   -webkit-border-bottom-left-radius: 4px;  
  60.   -moz-border-radius-bottomleft: 4px;  
  61.   border-bottom-left-radius: 4px;  
  62. }  
  63. .pagination ul > li:last-child > a,  
  64. .pagination ul > li:last-child > span,  
  65. .pagination #lastspan {  
  66.   -webkit-border-top-right-radius: 4px;  
  67.   -moz-border-radius-topright: 4px;  
  68.   border-top-right-radius: 4px;  
  69.   -webkit-border-bottom-right-radius: 4px;  
  70.   -moz-border-radius-bottomright: 4px;  
  71.   border-bottom-right-radius: 4px;  
  72. }  
  73. .pagination-centered {  
  74.   text-aligncenter;  
  75. }  
  76. .pagination-right {  
  77.   text-alignright;  
  78. }  
  79. .pagination-large ul > li > a,  
  80. .pagination-large ul > li > span,  
  81. .pagination-large #lastspan{  
  82.   padding11px 19px;  
  83.   font-size17.5px;  
  84. }  
  85. .pagination-large ul > li:first-child > a,  
  86. .pagination-large ul > li:first-child > span {  
  87.   -webkit-border-top-left-radius: 6px;  
  88.   -moz-border-radius-topleft: 6px;  
  89.   border-top-left-radius: 6px;  
  90.   -webkit-border-bottom-left-radius: 6px;  
  91.   -moz-border-radius-bottomleft: 6px;  
  92.   border-bottom-left-radius: 6px;  
  93. }  
  94. .pagination-large ul > li:last-child > a,  
  95. .pagination-large ul > li:last-child > span,  
  96. .pagination-large #lastspan {  
  97.   -webkit-border-top-right-radius: 6px;  
  98.   -moz-border-radius-topright: 6px;  
  99.   border-top-right-radius: 6px;  
  100.   -webkit-border-bottom-right-radius: 6px;  
  101.   -moz-border-radius-bottomright: 6px;  
  102.   border-bottom-right-radius: 6px;  
  103. }  
  104. .pagination-mini ul > li:first-child > a,  
  105. .pagination-small ul > li:first-child > a,  
  106. .pagination-mini ul > li:first-child > span,  
  107. .pagination-small ul > li:first-child > span {  
  108.   -webkit-border-top-left-radius: 3px;  
  109.   -moz-border-radius-topleft: 3px;  
  110.   border-top-left-radius: 3px;  
  111.   -webkit-border-bottom-left-radius: 3px;  
  112.   -moz-border-radius-bottomleft: 3px;  
  113.   border-bottom-left-radius: 3px;  
  114. }  
  115. .pagination-mini ul > li:last-child > a,  
  116. .pagination-small ul > li:last-child > a,  
  117. .pagination-mini ul > li:last-child > span,  
  118. .pagination-small ul > li:last-child > span {  
  119.   -webkit-border-top-right-radius: 3px;  
  120.   -moz-border-radius-topright: 3px;  
  121.   border-top-right-radius: 3px;  
  122.   -webkit-border-bottom-right-radius: 3px;  
  123.   -moz-border-radius-bottomright: 3px;  
  124.   border-bottom-right-radius: 3px;  
  125. }  
  126. .pagination-small ul > li > a,  
  127. .pagination-small ul > li > span {  
  128.   padding2px 10px;  
  129.   font-size11.9px;  
  130. }  
  131. .pagination-mini ul > li > a,  
  132. .pagination-mini ul > li > span {  
  133.   padding0 6px;  
  134.   font-size10.5px;  
  135. }  

-------------------------------------------------------------------------------
Page.class.php

 

 

  1. <?php  
  2. // +----------------------------------------------------------------------  
  3. // | ThinkPHP [ WE CAN DO IT JUST THINK IT ]  
  4. // +----------------------------------------------------------------------  
  5. // | Copyright (c) 2009 http://thinkphp.cn All rights reserved.  
  6. // +----------------------------------------------------------------------  
  7. // | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )  
  8. // +----------------------------------------------------------------------  
  9. // | Author: liu21st <liu21st@gmail.com>  
  10. // |         lanfengye <zibin_5257@163.com>  
  11. // +----------------------------------------------------------------------  
  12. class Page {  
  13.       
  14.     // 分頁(yè)欄每頁(yè)顯示的頁(yè)數(shù)  
  15.     public $rollPage = 5;  
  16.     // 頁(yè)數(shù)跳轉(zhuǎn)時(shí)要帶的參數(shù)  
  17.     public $parameter  ;  
  18.     // 分頁(yè)URL地址  
  19.     public $url     =   '';  
  20.     // 默認(rèn)列表每頁(yè)顯示行數(shù)  
  21.     public $listRows = 20;  
  22.     // 起始行數(shù)  
  23.     public $firstRow    ;  
  24.     // 分頁(yè)總頁(yè)面數(shù)  
  25.     protected $totalPages  ;  
  26.     // 總行數(shù)  
  27.     protected $totalRows  ;  
  28.     // 當(dāng)前頁(yè)數(shù)  
  29.     protected $nowPage    ;  
  30.     // 分頁(yè)的欄的總頁(yè)數(shù)  
  31.     protected $coolPages   ;  
  32.     // 分頁(yè)顯示定制  
  33.     protected $config  =    array('header'=>'條記錄','prev'=>'上一頁(yè)','next'=>'下一頁(yè)','first'=>'第一頁(yè)','last'=>'<span id="lastspan">最后一頁(yè)</span>','theme'=>'<ul><li><span> %totalRow% %header% %nowPage%/%totalPage% 頁(yè)</span></li> %first%  %upPage% %prePage%  %linkPage% %downPage%  %nextPage% %end%</ul>');  
  34.     // 默認(rèn)分頁(yè)變量名  
  35.     protected $varPage;  
  36.     /** 
  37.      * 架構(gòu)函數(shù) 
  38.      * @access public 
  39.      * @param array $totalRows  總的記錄數(shù) 
  40.      * @param array $listRows  每頁(yè)顯示記錄數(shù) 
  41.      * @param array $parameter  分頁(yè)跳轉(zhuǎn)的參數(shù) 
  42.      */  
  43.     public function __construct($totalRows,$listRows='',$parameter='',$url='') {  
  44.         $this->totalRows    =   $totalRows;  
  45.         $this->parameter    =   $parameter;  
  46.         $this->varPage      =   C('VAR_PAGE') ? C('VAR_PAGE') : 'p' ;  
  47.         if(!empty($listRows)) {  
  48.             $this->listRows =   intval($listRows);  
  49.         }  
  50.         $this->totalPages   =   ceil($this->totalRows/$this->listRows);     //總頁(yè)數(shù)  
  51.         $this->coolPages    =   ceil($this->totalPages/$this->rollPage);  
  52.         $this->nowPage      =   !empty($_GET[$this->varPage])?intval($_GET[$this->varPage]):1;  
  53.         if($this->nowPage<1){  
  54.             $this->nowPage  =   1;  
  55.         }elseif(!empty($this->totalPages) && $this->nowPage>$this->totalPages) {  
  56.             $this->nowPage  =   $this->totalPages;  
  57.         }  
  58.         $this->firstRow     =   $this->listRows*($this->nowPage-1);  
  59.         if(!empty($url))    $this->url  =   $url;   
  60.     }  
  61.     public function setConfig($name,$value) {  
  62.         if(isset($this->config[$name])) {  
  63.             $this->config[$name]    =   $value;  
  64.         }  
  65.     }  
  66.     /** 
  67.      * 分頁(yè)顯示輸出 
  68.      * @access public 
  69.      */  
  70.     public function show() {  
  71.         if(0 == $this->totalRows) return '';  
  72.         $p              =   $this->varPage;  
  73.         $nowCoolPage    =   ceil($this->nowPage/$this->rollPage);  
  74.         // 分析分頁(yè)參數(shù)  
  75.         if($this->url){  
  76.             $depr       =   C('URL_PATHINFO_DEPR');  
  77.             $url        =   rtrim(U('/'.$this->url,'',false),$depr).$depr.'__PAGE__';  
  78.         }else{  
  79.             if($this->parameter && is_string($this->parameter)) {  
  80.                 parse_str($this->parameter,$parameter);  
  81.             }elseif(is_array($this->parameter)){  
  82.                 $parameter      =   $this->parameter;  
  83.             }elseif(empty($this->parameter)){  
  84.                 unset($_GET[C('VAR_URL_PARAMS')]);  
  85.                 $var =  !empty($_POST)?$_POST:$_GET;  
  86.                 if(empty($var)) {  
  87.                     $parameter  =   array();  
  88.                 }else{  
  89.                     $parameter  =   $var;  
  90.                 }  
  91.             }  
  92.             $parameter[$p]  =   '__PAGE__';  
  93.             $url            =   U('',$parameter);  
  94.         }  
  95.         //上下翻頁(yè)字符串  
  96.         $upRow          =   $this->nowPage-1;  
  97.         $downRow        =   $this->nowPage+1;  
  98.         if ($upRow>0){  
  99.             $upPage     =    "<li><a href='".str_replace('__PAGE__',$upRow,$url)."'>".$this->config['prev']."</a></li>";  
  100.         }else{  
  101.             $upPage     =    '';  
  102.         }  
  103.         if ($downRow <= $this->totalPages){  
  104.             $downPage   =   "<li><a href='".str_replace('__PAGE__',$downRow,$url)."'>".$this->config['next']."</a></li>";  
  105.         }else{  
  106.             $downPage   =   '';  
  107.         }  
  108.         // << < > >>  
  109.         if($nowCoolPage == 1){  
  110.             $theFirst   =   '';  
  111.             $prePage    =   '';  
  112.         }else{  
  113.             $preRow     =   $this->nowPage-$this->rollPage;  
  114.             $prePage    =   "<li><a href='".str_replace('__PAGE__',$preRow,$url)."' >上".$this->rollPage."頁(yè)</a></li>";  
  115.             $theFirst   =   "<li><a href='".str_replace('__PAGE__',1,$url)."' >".$this->config['first']."</a></li>";  
  116.         }  
  117.         if($nowCoolPage == $this->coolPages){  
  118.             $nextPage   =   '';  
  119.             $theEnd     =   '';  
  120.         }else{  
  121.             $nextRow    =   $this->nowPage+$this->rollPage;  
  122.             $theEndRow  =   $this->totalPages;  
  123.             $nextPage   =   "<li><a href='".str_replace('__PAGE__',$nextRow,$url)."' >下".$this->rollPage."頁(yè)</a></li>";  
  124.             $theEnd     =   "</li><a href='".str_replace('__PAGE__',$theEndRow,$url)."' >".$this->config['last']."</a></li>";  
  125.         }  
  126.         // 1 2 3 4 5  
  127.         $linkPage = "";  
  128.         for($i=1;$i<=$this->rollPage;$i++){  
  129.             $page       =   ($nowCoolPage-1)*$this->rollPage+$i;  
  130.             if($page!=$this->nowPage){  
  131.                 if($page<=$this->totalPages){  
  132.                     $linkPage .= "<li><a href='".str_replace('__PAGE__',$page,$url)."'>".$page."</a></li>";  
  133.                 }else{  
  134.                     break;  
  135.                 }  
  136.             }else{  
  137.                 if($this->totalPages != 1){  
  138.                     $linkPage .= "<li><span class='current'>".$page."</span></li>";  
  139.                 }  
  140.             }  
  141.         }  
  142.         $pageStr     =   str_replace(  
  143.             array('%header%','%nowPage%','%totalRow%','%totalPage%','%upPage%','%downPage%','%first%','%prePage%','%linkPage%','%nextPage%','%end%'),  
  144.             array($this->config['header'],$this->nowPage,$this->totalRows,$this->totalPages,$upPage,$downPage,$theFirst,$prePage,$linkPage,$nextPage,$theEnd),$this->config['theme']);  
  145.         return $pageStr;  
  146.     }  
  147. }  

------------------------------------------------------------------------------
模板中使用:

 

<div class="pagination">{$page}</div> //基本樣式
<div class="pagination pagination-large">{$page}</div>//大號(hào)數(shù)字樣式

 

控制類代碼:

 

  1. $p = new Page ($count,10);     
  2.         $products = $this->product_model->where($where)->order($order.' '.$method)->limit($p->firstRow.','.$p->listRows)->select();  
  3.         $page = $p->show ();     
  4.               
  5.         $this->assign( "page"$page );  

【網(wǎng)站聲明】本站除付費(fèi)源碼經(jīng)過(guò)測(cè)試外,其他素材未做測(cè)試,不保證完整性,網(wǎng)站上部分源碼僅限學(xué)習(xí)交流,請(qǐng)勿用于商業(yè)用途。如損害你的權(quán)益請(qǐng)聯(lián)系客服QQ:2655101040 給予處理,謝謝支持。

相關(guān)文檔推薦

Bootstrap 分頁(yè) 本章將講解 Bootstrap 支持的分頁(yè)特性。分頁(yè)(Pagination),是一種無(wú)序列表,Bootstrap 像處理其他界面元素一樣處理分頁(yè)。 分頁(yè)(Pagination) 下表列出了 Bootstrap 提供的處理分頁(yè)
主站蜘蛛池模板: 北京模型公司-军事模型-工业模型制作-北京百艺模型沙盘公司 | 底部填充胶_电子封装胶_芯片封装胶_芯片底部填充胶厂家-东莞汉思新材料 | 橡胶电子拉力机-塑料-微电脑电子拉力试验机厂家-江苏天源 | 悬浮拼装地板_篮球场木地板翻新_运动木地板价格-上海越禾运动地板厂家 | SPC工作站-连杆综合检具-表盘气动量仪-内孔缺陷检测仪-杭州朗多检测仪器有限公司 | 道达尔润滑油-食品级润滑油-道达尔导热油-合成导热油,深圳道达尔代理商合-深圳浩方正大官网 | 湖南教师资格网-湖南教师资格证考试网| 心肺复苏模拟人|医学模型|急救护理模型|医学教学模型上海康人医学仪器设备有限公司 | 长沙广告公司_制作,长沙喷绘_发光字_招牌制作_长沙泓润广告官网 长城人品牌官网 | 阿尔法-MDR2000无转子硫化仪-STM566 SATRA拉力试验机-青岛阿尔法仪器有限公司 | 河南橡胶接头厂家,河南波纹补偿器厂家,河南可曲挠橡胶软连接,河南套筒补偿器厂家-河南正大阀门 | 水稻烘干机,小麦烘干机,大豆烘干机,玉米烘干机,粮食烘干机_巩义市锦华粮食烘干机械制造有限公司 水环真空泵厂家,2bv真空泵,2be真空泵-淄博真空设备厂 | 工业CT-无锡璟能智能仪器有限公司| 沧州友城管业有限公司-内外涂塑钢管-大口径螺旋钢管-涂塑螺旋管-保温钢管生产厂家 | 合肥注册公司|合肥代办营业执照、2024注册公司流程 | 慢回弹测试仪-落球回弹测试仪-北京冠测精电仪器设备有限公司 | [官网]叛逆孩子管教_戒网瘾学校_全封闭问题青少年素质教育_新起点青少年特训学校 | BHK汞灯-百科|上海熙浩实业有限公司 | 工装定制/做厂家/公司_工装订做/制价格/费用-北京圣达信工装 | 细砂提取机,隔膜板框泥浆污泥压滤机,螺旋洗砂机设备,轮式洗砂机械,机制砂,圆锥颚式反击式破碎机,振动筛,滚筒筛,喂料机- 上海重睿环保设备有限公司 | 北京开业庆典策划-年会活动策划公司-舞龙舞狮团大鼓表演-北京盛乾龙狮鼓乐礼仪庆典策划公司 | 海外整合营销-独立站营销-社交媒体运营_广州甲壳虫跨境网络服务 焊管生产线_焊管机组_轧辊模具_焊管设备_焊管设备厂家_石家庄翔昱机械 | 【星耀裂变】_企微SCRM_任务宝_视频号分销裂变_企业微信裂变增长_私域流量_裂变营销 | 首页|成都尚玖保洁_家政保洁_开荒保洁_成都保洁| 智慧养老_居家养老_社区养老_杰佳通| 安徽免检低氮锅炉_合肥燃油锅炉_安徽蒸汽发生器_合肥燃气锅炉-合肥扬诺锅炉有限公司 | 石家庄网站建设|石家庄网站制作|石家庄小程序开发|石家庄微信开发|网站建设公司|网站制作公司|微信小程序开发|手机APP开发|软件开发 | 变位机,焊接变位机,焊接变位器,小型变位机,小型焊接变位机-济南上弘机电设备有限公司 | 翅片管散热器价格_钢制暖气片报价_钢制板式散热器厂家「河北冀春暖气片有限公司」 | 碳钢法兰厂家,非标法兰,定制异型,法兰生产厂家-河北九瑞管道 | 手机存放柜,超市储物柜,电子储物柜,自动寄存柜,行李寄存柜,自动存包柜,条码存包柜-上海天琪实业有限公司 | 南京交通事故律师-专打交通事故的南京律师 | 浴室柜-浴室镜厂家-YINAISI · 意大利设计师品牌 | 咿耐斯 |-浙江台州市丰源卫浴有限公司 | 鹤壁创新仪器公司-全自动量热仪,定硫仪,煤炭测硫仪,灰熔点测定仪,快速自动测氢仪,工业分析仪,煤质化验仪器 | 氨水-液氨-工业氨水-氨水生产厂家-辽宁顺程化工 | 不锈钢列管式冷凝器,换热器厂家-无锡飞尔诺环境工程有限公司 | 挤奶设备过滤纸,牛奶过滤纸,挤奶机过滤袋-济南蓝贝尔工贸有限公司 | 微波消解仪器_智能微波消解仪报价_高压微波消解仪厂家_那艾 | 存包柜厂家_电子存包柜_超市存包柜_超市电子存包柜_自动存包柜-洛阳中星 | 污水处理设备,一体化泵站,一体化净水设备-「梦之洁环保设备厂家」 | 洛阳防爆合格证办理-洛阳防爆认证机构-洛阳申请国家防爆合格证-洛阳本安防爆认证代办-洛阳沪南抚防爆电气技术服务有限公司 |