




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報或認(rèn)領(lǐng)
文檔簡介
第thinkPHP5框架分頁樣式類完整示例namespacepage;
//+
//|ThinkPHP[WECANDOITJUSTTHINK]
//+
//|Copyright(c)2006~2017Allrightsreserved.
//+
//|Licensed(/licenses/LICENSE-2.0)
//+
//|Author:zhangyajun448901948@
//+
usethink\Paginator;
classPageextendsPaginator
//首頁
protectedfunctionhome(){
if($this-currentPage()1){
return"ahref='".$this-url(1)."'title='首頁'首頁/a
}else{
return"p首頁/p
//上一頁
protectedfunctionprev(){
if($this-currentPage()1){
return"ahref='".$this-url($this-current1)."'title='上一頁'上一頁/a
}else{
return"p上一頁/p
//下一頁
protectedfunctionnext(){
if($this-hasMore){
return"ahref='".$this-url($this-currentPage+1)."'title='下一頁'下一頁/a
}else{
return"p下一頁/p
//尾頁
protectedfunctionlast(){
if($this-hasMore){
return"ahref='".$this-url($this-lastPage)."'title='尾頁'尾頁/a
}else{
return"p尾頁/p
//統(tǒng)計信息
protectedfunctioninfo(){
return"p共b".$this-lastPage.
"/b頁b".$this-total."/b條數(shù)據(jù)/p
*頁碼按鈕
*@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;
*渲染分頁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()
*生成一個可點擊的按鈕
*@paramstring$url
*@paramint$page
*@returnstring
protectedfunctiongetAvailablePageWrapper($url,$page)
return'ahref="'.htmlentities($url).'"rel="externalnofollow"title="第"'.$page.'"頁"'.$page.'/a
*生成一個禁用的按鈕
*@paramstring$text
*@returnstring
protectedfunctiongetDisabledTextWrapper($text)
return'p'.$text.'/p
*生成一個激活的按鈕
*@paramstring$text
*@returnstring
protectedfunctiongetActivePageWrapper($text)
return'ahref=""externalnofollow"cur"'.$text.'/a
*生成省略號按鈕
*@returnstring
protectedfunctiongetDots()
return$this-getDisabledTextWrapper('...');
*批量生成頁碼按鈕.
*@paramarray$urls
*@returnstring
protectedfunctiongetUrlLinks(array$urls)
$html='';
foreach($urlsas$page=$url){
$html.=$this-getPageLinkWrapper($url,$page);
return$html;
*生成普通頁碼按鈕
*@paramstring$url
*@paramint$page
*@returnstring
protectedfunctiongetPageLinkWrapper($url,$page)
if($page==$this-currentPage()){
return$this-getActivePageWrapper($page);
return$this-getAvailablePageWrapper($url,$page);
*分頁樣式
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. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 漢字目教學(xué)課件
- 精美教學(xué)課件模板下載
- 敬學(xué)尊師傳統(tǒng)文化課件
- 兒童康復(fù)教學(xué)課件下載
- 四川省線上教學(xué)解讀課件
- 畫風(fēng)箏教學(xué)課件
- 教育技術(shù)課件類選題要求
- 【兵團(tuán)】2025年新疆生產(chǎn)建設(shè)兵團(tuán)第八師石河子市面向社會招聘大學(xué)生鄉(xiāng)村醫(yī)生33人筆試歷年典型考題及考點剖析附帶答案詳解
- 易錯點14 國家機(jī)構(gòu)-備戰(zhàn)2021年中考道德與法治一輪復(fù)習(xí)易錯題
- 春節(jié)期間馬場活動方案
- 柳州某醫(yī)院空氣源熱泵熱水系統(tǒng)設(shè)計案例
- 西師大版六年級數(shù)學(xué)下冊第四單元 扇形統(tǒng)計圖 單元概述和課時安排
- 高中英語全國高考考綱詞匯3600匯總
- 《中越傳統(tǒng)節(jié)日對比問題研究5100字【論文】》
- 特勞特戰(zhàn)略定位總裁課程課件
- 《 民航服務(wù)心理學(xué)》考試題及參考答案
- 公務(wù)員培訓(xùn)包過班協(xié)議書范本
- 2021學(xué)堂在線網(wǎng)課《生活英語讀寫》課后作業(yè)單元考核答案
- 中國近現(xiàn)代史綱要超星爾雅答案貴州大學(xué)-
- Q∕GDW 12162-2021 隔離開關(guān)分合閘位置雙確認(rèn)系統(tǒng)技術(shù)規(guī)范
- 燃?xì)馊霊舭矙z培訓(xùn)PPT.ppt
評論
0/150
提交評論