国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 開(kāi)發(fā) > PHP > 正文

php分頁(yè)類

2024-05-04 21:51:06
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友
<?php
//
// ----------------------------------------------------------------------
// | 分頁(yè)類                                |
// ----------------------------------------------------------------------
// | Copyright (c) 2001 NetFish Software                 |
// |                                   |
// | Author: whxbb(whxbbh@21cn.com)                    |
// ----------------------------------------------------------------------
//
// $Id: pager.class.php,v 0.1 2001/8/2 13:18:13 yf Exp $
//
// 禁止直接訪問(wèn)該頁(yè)面
if (basename($HTTP_SERVER_VARS['PHP_SELF']) == "pager.class.php") {
   header("HTTP/1.0 404 Not Found");
}
/**
* 分頁(yè)類
* Purpose
* 分頁(yè)
*
* @author : whxbb(whxbb@21cn.com)
* @version : 0.1
* @date  : 2001/8/2
*/
class Pager
{
   /** 總信息數(shù) */
   var $infoCount;
   /** 總頁(yè)數(shù) */
   var $pageCount;
   /** 每頁(yè)顯示條數(shù) */
   var $items;
   /** 當(dāng)前頁(yè)碼 */
   var $pageNo;
   /** 查詢的起始位置 */
   var $startPos;
   var $nextPageNo;
   var $prevPageNo;
 
   function Pager($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;
   }
}
?>

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 凉城县| 景宁| 昆明市| 大田县| 永登县| 文登市| 三门峡市| 大英县| 泰和县| 高要市| 双辽市| 宾阳县| 潞城市| 交城县| 东乡县| 巩义市| 鲁山县| 邹平县| 安陆市| 孟村| 永靖县| 腾冲县| 肃宁县| 定边县| 三台县| 襄城县| 曲麻莱县| 德化县| 邹城市| 务川| 元氏县| 永修县| 泗阳县| 马关县| 商水县| 万安县| 深圳市| 闻喜县| 通渭县| 襄垣县| 澳门|