最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

php相當(dāng)簡(jiǎn)單的分頁(yè)類

 更新時(shí)間:2008年10月02日 01:14:05   作者:  
代碼比較簡(jiǎn)單,學(xué)習(xí)php類的朋友,可以看下
class Helper_Page{

/** 總信息數(shù) */
var $infoCount;
/** 總頁(yè)數(shù) */
var $pageCount;
/** 每頁(yè)顯示條數(shù) */
var $items;
/** 當(dāng)前頁(yè)碼 */
var $pageNo;
/** 查詢的起始位置 */
var $startPos;
/** 下一頁(yè) */
var $nextPageNo;
/** 上一頁(yè) */
var $prevPageNo;

function Helper_Page($infoCount, $items, $pageNo)
{
$this->infoCount = $infoCount;
$this->items = $items;
$this->pageNo = $pageNo;
$this->pageCount = $this->GetPageCount();
$this->AdjustPageNo();
$this->startPos = $this->GetStartPos();
}
function AdjustPageNo()
{
if($this->pageNo == '' || $this->pageNo < 1)
$this->pageNo = 1;
if ($this->pageNo > $this->pageCount)
$this->pageNo = $this->pageCount;
}
/**
* 下一頁(yè)
*/
function GoToNextPage()
{
$nextPageNo = $this->pageNo + 1;
if ($nextPageNo > $this->pageCount)
{
$this->nextPageNo = $this->pageCount;
return false;
}
$this->nextPageNo = $nextPageNo;
return true;
}
/**
* 上一頁(yè)
*/
function GotoPrevPage()
{
$prevPageNo = $this->pageNo - 1;
if ($prevPageNo < 1)
{
$this->prevPageNo = 1;
return false;
}
$this->prevPageNo = $prevPageNo;
return true;
}
function GetPageCount()
{
return ceil($this->infoCount / $this->items);
}
function GetStartPos()
{
return ($this->pageNo - 1) * $this->items;
}
}

相關(guān)文章

最新評(píng)論

柘荣县| 温宿县| 泽州县| 黄山市| 时尚| 昌吉市| 彭州市| 大悟县| 中宁县| 石泉县| 柘荣县| 台州市| 靖宇县| 扎赉特旗| 九龙坡区| 平湖市| 霍城县| 土默特右旗| 通许县| 裕民县| 永春县| 冕宁县| 镇安县| 苍山县| 高州市| 彭州市| 玉门市| 台南市| 永德县| 特克斯县| 阳春市| 宜春市| 南澳县| 甘德县| 景泰县| 玉树县| 张家口市| 建瓯市| 阿勒泰市| 昌宁县| 临安市|