




版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
第thinkPHP5框架分頁(yè)樣式類(lèi)完整示例namespacepage;
//+
//|ThinkPHP[WECANDOITJUSTTHINK]
//+
//|Copyright(c)2006~2017Allrightsreserved.
//+
//|Licensed(/licenses/LICENSE-2.0)
//+
//|Author:zhangyajun448901948@
//+
usethink\Paginator;
classPageextendsPaginator
//首頁(yè)
protectedfunctionhome(){
if($this-currentPage()1){
return"ahref='".$this-url(1)."'title='首頁(yè)'首頁(yè)/a
}else{
return"p首頁(yè)/p
//上一頁(yè)
protectedfunctionprev(){
if($this-currentPage()1){
return"ahref='".$this-url($this-current1)."'title='上一頁(yè)'上一頁(yè)/a
}else{
return"p上一頁(yè)/p
//下一頁(yè)
protectedfunctionnext(){
if($this-hasMore){
return"ahref='".$this-url($this-currentPage+1)."'title='下一頁(yè)'下一頁(yè)/a
}else{
return"p下一頁(yè)/p
//尾頁(yè)
protectedfunctionlast(){
if($this-hasMore){
return"ahref='".$this-url($this-lastPage)."'title='尾頁(yè)'尾頁(yè)/a
}else{
return"p尾頁(yè)/p
//統(tǒng)計(jì)信息
protectedfunctioninfo(){
return"p共b".$this-lastPage.
"/b頁(yè)b".$this-total."/b條數(shù)據(jù)/p
*頁(yè)碼按鈕
*@returnstring
protectedfunctiongetLinks()
$block=[
'first'=null,
'slider'=null,
'last'=null
$side=3;
$window=$side*2;
if($this-lastPage$window+6){
$block['first']=$this-getUrlRange(1,$this-lastPage);
}elseif($this-currentPage=$window){
$block['first']=$this-getUrlRange(1,$window+2);
$block['last']=$this-getUrlRange($this-last1,$this-lastPage);
}elseif($this-currentPage($this-last$window)){
$block['first']=$this-getUrlRange(1,2);
$block['last']=$this-getUrlRange($this-last($window+2),$this-lastPage);
}else{
$block['first']=$this-getUrlRange(1,2);
$block['slider']=$this-getUrlRange($this-current$side,$this-currentPage+$side);
$block['last']=$this-getUrlRange($this-last1,$this-lastPage);
$html='';
if(is_array($block['first'])){
$html.=$this-getUrlLinks($block['first']);
if(is_array($block['slider'])){
$html.=$this-getDots();
$html.=$this-getUrlLinks($block['slider']);
if(is_array($block['last'])){
$html.=$this-getDots();
$html.=$this-getUrlLinks($block['last']);
return$html;
*渲染分頁(yè)html
*@returnmixed
publicfunctionrender()
if($this-hasPages()){
if($this-simple){
returnsprintf(
'%sdiv%s%s%s/div',
$this-css(),
$this-prev(),
$this-getLinks(),
$this-next()
}else{
returnsprintf(
'%sdiv%s%s%s%s%s%s/div',
$this-css(),
$this-home(),
$this-prev(),
$this-getLinks(),
$this-next(),
$this-last(),
$this-info()
*生成一個(gè)可點(diǎn)擊的按鈕
*@paramstring$url
*@paramint$page
*@returnstring
protectedfunctiongetAvailablePageWrapper($url,$page)
return'ahref="'.htmlentities($url).'"rel="externalnofollow"title="第"'.$page.'"頁(yè)"'.$page.'/a
*生成一個(gè)禁用的按鈕
*@paramstring$text
*@returnstring
protectedfunctiongetDisabledTextWrapper($text)
return'p'.$text.'/p
*生成一個(gè)激活的按鈕
*@paramstring$text
*@returnstring
protectedfunctiongetActivePageWrapper($text)
return'ahref=""externalnofollow"cur"'.$text.'/a
*生成省略號(hào)按鈕
*@returnstring
protectedfunctiongetDots()
return$this-getDisabledTextWrapper('...');
*批量生成頁(yè)碼按鈕.
*@paramarray$urls
*@returnstring
protectedfunctiongetUrlLinks(array$urls)
$html='';
foreach($urlsas$page=$url){
$html.=$this-getPageLinkWrapper($url,$page);
return$html;
*生成普通頁(yè)碼按鈕
*@paramstring$url
*@paramint$page
*@returnstring
protectedfunctiongetPageLinkWrapper($url,$page)
if($page==$this-currentPage()){
return$this-getActivePageWrapper($page);
return$this-getAvailablePageWrapper($url,$page);
*分頁(yè)樣式
protectedfunctioncss(){
return'styletype="text/css"
.paginationp{
margin:0;
cursor:pointer
.pagination{
height:40px;
padding:20px0px;
.paginationa{
display:block;
float:left;
margin-right:10px;
padding:2px12px;
border:1px#ccccccsolid;
background:#fff;
text-decoration:none;
color:#808080;
font-size:12px;
line-height:24px;
.paginationa:hover{
color:#009688;
background:white;
border:1px#009688solid;
.paginationa.cur{
border:none;
background:#009688;
color:#fff;
.paginationp{
float:left;
padding:2px12px;
font-size:12px;
line-height:24px;
color:#bbb;
border:1px#cccsolid;
background:#fcfcfc;
margin-right:8px;
.paginationp.pageRemark{
border-style:none;
background:none;
margin-right:0px;
padding:4px0px;
color:#666;
.paginationp.pageRemarkb{
color:red;
.paginationp.pageEllipsis{
border-style:none;
background:none;
padding:4px0px;
color:#808080;
.datesli{font-size:14
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 產(chǎn)品研發(fā)及技術(shù)研發(fā)合作協(xié)議
- 專(zhuān)業(yè)市場(chǎng)招商合作協(xié)議合同書(shū)
- 《營(yíng)銷(xiāo)策略》課件
- 銷(xiāo)售代理業(yè)務(wù)委托協(xié)議書(shū)
- 消費(fèi)全返協(xié)議書(shū)
- 城市交通管理智能化系統(tǒng)開(kāi)發(fā)合同
- 車(chē)位租賃押金合同協(xié)議
- 連鎖超市合作協(xié)議合同
- 安裝工程內(nèi)部承包協(xié)議
- 車(chē)位購(gòu)銷(xiāo)協(xié)議書(shū)范本
- 圖書(shū)館筆試題及答案
- 第3課 中華文明的起源(教學(xué)設(shè)計(jì))七年級(jí)歷史上冊(cè)同步高效課堂(統(tǒng)編版2024)
- 貴州省貴陽(yáng)市重點(diǎn)中學(xué)2024-2025學(xué)年高一年級(jí)下冊(cè)開(kāi)學(xué)考試語(yǔ)文試卷(含答案)
- 2025年山東省淄博市高新區(qū)中考一模歷史試題(原卷版+解析版)
- 2025年高考數(shù)學(xué)壓軸題分層練習(xí):概率與統(tǒng)計(jì)(40題)
- 醫(yī)院抹布拖把標(biāo)識(shí)管理
- 2024年高校輔導(dǎo)員筆試重點(diǎn)試題及答案
- 農(nóng)藝師行業(yè)標(biāo)準(zhǔn)與職業(yè)道德探討試題及答案
- 人工智能在情緒調(diào)節(jié)與積極心理學(xué)中的應(yīng)用-全面剖析
- 2025年4月版安全法律法規(guī)標(biāo)準(zhǔn)文件清單
- 公安規(guī)范化執(zhí)法
評(píng)論
0/150
提交評(píng)論