




版權說明:本文檔由用戶提供并上傳,收益歸屬內容提供方,若內容存在侵權,請進行舉報或認領
文檔簡介
第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
//統計信息
protectedfunctioninfo(){
return"p共b".$this-lastPage.
"/b頁b".$this-total."/b條數據/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. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯系上傳者。文件的所有權益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網頁內容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經權益所有人同意不得將文件中的內容挪作商業或盈利用途。
- 5. 人人文庫網僅提供信息存儲空間,僅對用戶上傳內容的表現方式做保護處理,對用戶上傳分享的文檔內容本身不做任何修改或編輯,并不能對任何下載內容負責。
- 6. 下載文件中如有侵權或不適當內容,請與我們聯系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 股權質押擔保知識產權轉讓合同
- 影視特效制作與特效制作技術支持與維護服務合同
- 子女心理健康咨詢服務費用結算與保密協議
- 體育場館設施日常清潔與維護服務協議
- 寫字樓智能化系統維護與升級責任合同
- 抖音短視頻團購內容策劃與執行代運營協議
- 虛擬商品交易平臺實名認證及交易安全保障協議
- 網絡直播平臺公會合作經營協議
- 藝術品鑒定評估與藝術品物流運輸協議
- 網絡文學作品有聲錄制棚租賃服務協議書
- 體育商業綜合體規劃方案
- 醫保工作自查表
- 管道支吊架培訓教材課件
- COPD病人出院計劃
- 公司文件會審表
- (中職)體育與健康第七章 籃球運動課件
- 2、工程工質量保證體系框圖
- 地鐵工程車輛段路基填方施工方案
- 路基路面排水設計(配圖說明共50頁)
- 有關種子農藥化肥購銷合同模板
- 山東水利定額使用說明
評論
0/150
提交評論