欧美三区_成人在线免费观看视频_欧美极品少妇xxxxⅹ免费视频_a级毛片免费播放_鲁一鲁中文字幕久久_亚洲一级特黄

MyZ分頁(yè)類

系統(tǒng) 2297 0

版權(quán)聲明:原創(chuàng)作品,允許轉(zhuǎn)載,轉(zhuǎn)載時(shí)請(qǐng)務(wù)必以超鏈接形式標(biāo)明文章原始出版、作者信息和本聲明。否則將追究法律責(zé)任。 http://blog.csdn.net/mayongzhan - 馬永占,myz,mayongzhan

花了點(diǎn)時(shí)間寫(xiě)了個(gè)分頁(yè)類,看著還不錯(cuò),測(cè)試了下能用,離實(shí)際應(yīng)用應(yīng)該就剩一個(gè)樣式了.

_tatal等等之所以要寫(xiě)成帶下劃線,是因?yàn)檫@些內(nèi)容需要帶入到地址欄中,實(shí)際當(dāng)中可能會(huì)重名

link的作用是有時(shí)得到的數(shù)據(jù)是為了使分頁(yè)跳轉(zhuǎn)的時(shí)候帶上參數(shù)

寫(xiě)很比教長(zhǎng)的時(shí)間.有點(diǎn)模仿小李的分頁(yè),沒(méi)加樣式,這樣更好

<!-- 分頁(yè)類 , 加測(cè)試 ~~~ -->

<? php

/* *

*@nametest.php

*@dateWedDec0521:49:45CST2007

*@copyright馬永占(MyZ)

*@author馬永占(MyZ)

*@linkhttp://blog.csdn.net/mayongzhan/

*/



class Pager

{

private $_tatal ; // 總數(shù),記錄的總條數(shù)

private $_nowPage = 1 ; // 當(dāng)前頁(yè)

private $_rows = 40 ; // 行數(shù)

private $pages ; // 頁(yè)數(shù),可以通過(guò)總數(shù)和行數(shù)計(jì)算出來(lái)

private $dataBegin = 0 ; // sql語(yǔ)句limit開(kāi)始的數(shù)字,可以通過(guò)行數(shù)和當(dāng)前頁(yè)計(jì)算出來(lái)

private $dataCount = 40 ; // sql語(yǔ)句limit取的數(shù)據(jù)量,根據(jù)行數(shù)來(lái)決定

private $link = '' ; // 分頁(yè)帶的其他參數(shù)

private $showCount = 10 ; // 頁(yè)碼顯示量

public function set_tatal( $_tatal )

{

$this -> _tatal = $_tatal ;

}

public function set_nowPage( $_nowPage )

{

$this -> _nowPage = $_nowPage ;

}

public function set_rows( $_rows )

{

$this -> _rows = $_rows ;

}

public function setLink( $link )

{

$this -> link = $link ;

}

public function setShowCount( $showCount )

{

$this -> showCount = $showCount ;

}

public function setPages()

{

$this -> pages = ( $this -> _tatal - $this -> _tatal % $this -> _rows) / $this -> _rows

+ intval ( $this -> _tatal % $this -> _rows == 0 ? 0 : 1 );

}

public function getDataBegin()

{

$this -> dataBegin = $this -> _nowPage * $this -> _rows;

return $this -> dataBegin;

}

public function getDataCount()

{

$this -> dataCount = $this -> _rows;

return $this -> dataCount;

}



public function createPager() // 創(chuàng)建分頁(yè)

{

$pagerList = ' <div> ' ;

// 首頁(yè)

if ( $this -> _nowPage > $this -> showCount && $this -> _nowPage != 1 ){

$pagerList = ' &nbsp;<ahref="? ' . $this -> link . '

&_tatal=
' . $this -> _tatal . '

&_rows=
' . $this -> _rows . '

&_nowPage=1"

title="首頁(yè)">1</a>&nbsp;...
' ;

}

// 前翻N頁(yè)

if ( $this -> _nowPage > $this -> showCount){

$pagerList .= ' &nbsp;<ahref="? ' . $this -> link . '

&_tatal=
' . $this -> _tatal . '

&_rows=
' . $this -> _rows . '

&_nowPage=
' . ( $this -> _nowPage - $this -> showCount) . ' "

title="前
' . $this -> showCount . ' 頁(yè)"><<</a> ' ;

}

// 前1頁(yè)

if ( $this -> _nowPage != 1 ){

$pagerList .= ' &nbsp;<ahref="? ' . $this -> link . '

&_tatal=
' . $this -> _tatal . '

&_rows=
' . $this -> _rows . '

&_nowPage=
' . ( $this -> _nowPage - 1 ) . ' "

title="前1頁(yè)"><</a>
' ;

}

$nowPageGroup = $this -> nowPageGroup(); // 得到當(dāng)前頁(yè)大分頁(yè)

$beginNowPage = ( $nowPageGroup - 1 ) * $this -> showCount + 1 ; // 得到開(kāi)始的頁(yè)碼

$i = 0 ;

while ( $beginNowPage <= $this -> pages && $i < 10 ){

if ( $beginNowPage != $this -> _nowPage){

$pagerList .= ' &nbsp;<ahref="? ' . $this -> link . '

&_tatal=
' . $this -> _tatal . '

&_rows=
' . $this -> _rows . '

&_nowPage=
' . $beginNowPage . ' "

title="第
' . $beginNowPage . ' 頁(yè)"> ' . $beginNowPage . ' </a> ' ;

}

else {

$pagerList .= ' &nbsp; ' . $beginNowPage ;

}

$i ++ ;

$beginNowPage ++ ;

}

// 后1頁(yè)

if ( $this -> _nowPage != $this -> pages){

$pagerList .= ' &nbsp;<ahref="? ' . $this -> link . '

&_tatal=
' . $this -> _tatal . '

&_rows=
' . $this -> _rows . '

&_nowPage=
' . ( $this -> _nowPage + 1 ) . ' "

title="后1頁(yè)">></a>
' ;

}

// 后翻N頁(yè)

if ( $this -> pages > $this -> showCount && $this -> lastShow()){

$pagerList .= ' &nbsp;<ahref="? ' . $this -> link . '

&_tatal=
' . $this -> _tatal . '

&_rows=
' . $this -> _rows . '

&_nowPage=
' . ( $this -> _nowPage + $this -> showCount) . ' "

title="后
' . $this -> showCount . ' 頁(yè)">>></a> ' ;

}

// 末頁(yè)

if ( $this -> pages > $this -> showCount && $this -> lastShow()){

$pagerList .= ' &nbsp;...&nbsp;<ahref="? ' . $this -> link . '

&_tatal=
' . $this -> _tatal . '

&_rows=
' . $this -> _rows . '

&_nowPage=
' . $this -> pages . ' "

title="末頁(yè)">
' . $this -> pages . ' </a> ' ;

}

$pagerList .= ' &nbsp;&nbsp;&nbsp;( ' ;

$pagerList .= ' 跳轉(zhuǎn)到<inputname="custompage"size="3"value=" ' . $this -> _nowPage . ' "onkeydown="if(event.keyCode==13){window.location= ' ? ' .$this->link. ' & _tatal = ' .$this->_tatal. ' & _rows = ' .$this->_rows. ' & _nowPage = ' +this.value+ '' ;returnfalse;}"type="text"/>/ ' . $this -> pages;

$pagerList .= ' ,每頁(yè)<inputname="custompage"size="3"value=" ' . $this -> _rows . ' "onkeydown="if(event.keyCode==13){window.location= ' ? ' .$this->link. ' & _tatal = ' .$this->_tatal. ' & _rows = ' +this.value+ ' & _nowPage = 1 ' ;returnfalse;}"type="text"/>行/ ' . $this -> _rows;

$pagerList .= ' )</div> ' ;

return $pagerList ;

}



private</spa
分享到:
評(píng)論

MyZ分頁(yè)類


更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號(hào)聯(lián)系: 360901061

您的支持是博主寫(xiě)作最大的動(dòng)力,如果您喜歡我的文章,感覺(jué)我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長(zhǎng)非常感激您!手機(jī)微信長(zhǎng)按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對(duì)您有幫助就好】

您的支持是博主寫(xiě)作最大的動(dòng)力,如果您喜歡我的文章,感覺(jué)我的文章對(duì)您有幫助,請(qǐng)用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長(zhǎng)會(huì)非常 感謝您的哦!!!

發(fā)表我的評(píng)論
最新評(píng)論 總共0條評(píng)論
主站蜘蛛池模板: 99色吧| 97热久久| 久久美女精品国产精品亚洲 | 欧美日韩在线一区二区 | 国产成人免费视频网站高清观看视频 | 欧美桃色视频 | 中文字幕自拍偷拍 | 热久久免费视频 | 中文字幕在线观看视频一区 | 国产亚洲第一页 | 国产中文字幕在线播放 | 免费视频在线看 | 精品欧美一区二区三区久久久小说 | 欧美精品一区二区三区在线播放 | 日韩福利视频一区 | 99久久一香蕉国产线看观看 | 无码缴情做A爱片毛片A片 | 欧美十区 | 国产精品亚洲片在线va | 久久伊人婷婷 | 成人在线视频在线观看 | 久久久av | 秋霞久久网| 国产一区二区在线看 | 国产精品久久久久久久久久久新郎 | 日韩欧美天堂 | 国产精品免费播放 | www.日本在线 | 婷婷香蕉 | 污污的网站免费观看 | 国产精品免费一级在线观看 | 色偷偷影院 | 欧美日韩性高爱潮视频 | 精品国产99| 91青青操 | 中文字幕一区二区三区四区不卡 | 成年网站在线看 | 成人欧美一区二区三区视频xxx | 在线视频中文字幕乱人伦 | 高清国语自产拍免费视频国产 | 欧美精品免费xxxxx视频 |