thinkPHP5框架分頁(yè)樣式類(lèi)完整示例_第1頁(yè)
thinkPHP5框架分頁(yè)樣式類(lèi)完整示例_第2頁(yè)
thinkPHP5框架分頁(yè)樣式類(lèi)完整示例_第3頁(yè)
thinkPHP5框架分頁(yè)樣式類(lèi)完整示例_第4頁(yè)
thinkPHP5框架分頁(yè)樣式類(lèi)完整示例_第5頁(yè)
已閱讀5頁(yè),還剩3頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(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ì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論