欧美三区_成人在线免费观看视频_欧美极品少妇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)論
主站蜘蛛池模板: 日韩精品手机在线 | 一区二区国产在线观看 | 大开眼界 无删减 | av 一区二区三区 | 日韩深夜福利 | 亚洲精品一区二区深夜福利 | 国产精品久久久久久久久久大牛 | 久久综合亚洲 | 亚洲精品久久久久一区二区三区 | 第一福利在线观看 | 免费成人在线网站 | 一级黄色绿像片 | 精品国产成人在线 | 艹逼免费视频 | 国产精品无码2021在线观看 | 一区二区三区四区视频 | 欧美第四页 | 玖操网| 欧美日韩精品一区二区在线播放 | 日日摸狠狠的摸夜夜摸 | 毛片资源 | 性色av免费在线观看 | 国产精品久久久久久无码人妻 | 全日本爽视频在线 | 99热久久国产综合精品久久国产 | 成人亚洲一区 | 夜色亚洲 | 成人免费观看国产高清 | 黄在线免费看 | 国产亚洲第一页 | 日本免费高清一区 | 日韩黄色一级视频 | 最新日本中文字幕在线观看 | jizzjizz丝袜老师 | 天天天天操 | 97国内精品久久久久久久影视 | 午夜精品一区二区三区在线观看 | 国产精品福利在线观看秒播 | 亚洲高清在线看 | 精品久久国产 | 国产精品久久久久久久久 |