




版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quá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)容里面會有圖紙預覽,若沒有圖紙預覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責。
- 6. 下載文件中如有侵權(quán)或不適當內(nèi)容,請與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準確性、安全性和完整性, 同時也不承擔用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。
最新文檔
- 體育場地建設中的工程難題及應對措施
- 初中德育課程改革計劃
- 城市綠化帶維護保修及售后措施
- 2024學年數(shù)學課堂教學創(chuàng)新計劃
- 以形助數(shù):高中代數(shù)可視化教學的探索與實踐
- 以幼兒為本:A幼兒園“同課異構(gòu)”教研活動的實踐探索與成效研究
- 以學生為中心:中職基礎英語課堂教學有效性的多維探究
- 以太極柔力球教學為鑰:開啟大學生體育鍛煉與心理和諧之門
- 以聲為翼:中學音樂教學中歌唱訓練的多維探索與實踐
- 工廠工業(yè)用地買賣合同協(xié)議書范文
- 公務員培訓包過班協(xié)議書范本
- 2021學堂在線網(wǎng)課《生活英語讀寫》課后作業(yè)單元考核答案
- 中國近現(xiàn)代史綱要超星爾雅答案貴州大學-
- 生理心理學(三版)教學課件全套電子教案匯總整本書課件最全教學教程完整版教案(最新)
- 職業(yè)危害防護設施、器具檢查維護記錄
- 食品全過程防護工作手冊(食品防護計劃)
- Q∕GDW 12162-2021 隔離開關(guān)分合閘位置雙確認系統(tǒng)技術(shù)規(guī)范
- 燃氣入戶安檢培訓PPT.ppt
- 臨概題庫(南醫(yī)大)--內(nèi)科部分
- 古代漢語授課教案(郭錫良版)教案分享
- 裝載機驅(qū)動橋培訓
評論
0/150
提交評論