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

首頁 > 開發 > PHP > 正文

php分頁類

2024-05-04 23:05:31
字體:
來源:轉載
供稿:網友
<?php
//
// +----------------------------------------------------------------------+
// | 分頁類                                |
// +----------------------------------------------------------------------+
// | copyright (c) 2001 netfish software                 |
// |                                   |
// | author: whxbb([email protected])                    |
// +----------------------------------------------------------------------+
//
// $id: pager.class.php,v 0.1 2001/8/2 13:18:13 yf exp $
//
// 禁止直接訪問該頁面
if (basename($http_server_vars['php_self']) == "pager.class.php") {
   header("http/1.0 404 not found");
}
/**
* 分頁類
* purpose
* 分頁
*
* @author : whxbb([email protected])
* @version : 0.1
* @date  : 2001/8/2
*/
class pager
{
   /** 總信息數 */
   var $infocount;
   /** 總頁數 */
   var $pagecount;
   /** 每頁顯示條數 */
   var $items;
   /** 當前頁碼 */
   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;
   }
   /**
    * 下一頁
    */
   function gotonextpage()
   {
     $nextpageno = $this->pageno + 1;
     if ($nextpageno > $this->pagecount)
     {
       $this->nextpageno = $this->pagecount;
       return false;
     }
     $this->nextpageno = $nextpageno;
     return true;
   }
   /**
    * 上一頁
    */
   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;
   }
}
?>

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 旬阳县| 剑阁县| 呼图壁县| 横山县| 松滋市| 葵青区| 泰兴市| 宾阳县| 吉水县| 瑞丽市| 班戈县| 浮山县| 湖南省| 蓝山县| 独山县| 密山市| 玉树县| 阳东县| 保定市| 读书| 临澧县| 定西市| 五原县| 汝南县| 太谷县| 石城县| 芒康县| 汨罗市| 吉林省| 青河县| 日喀则市| 石河子市| 隆回县| 报价| 钦州市| 金秀| 五家渠市| 辛集市| 南宫市| 石景山区| 无锡市|