日期:2013-04-11  浏览次数:20555 次

<?php
/*
+-----------------------------------------------------------------------+
| 作者:一天空一(曾用名:亿时代网络)
| 网址:www.phpwb.com www.esdwl.com
| Q Q: 31769416
| 时间:2006-05-03                                 
|+-----------------------------------------------------------------------+
*/
    class show_Pager
    {
      protected  $_total;                          //记录总数
      protected  $pagesize;                       //每一页显示的记录数
      public     $pages;                         //总页数
      protected  $_cur_page;                    //当前页码
      protected  $offset;                      //记录偏移量
      protected  $pager_Links;                //url连接
      protected  $pernum = 5;                //页码偏移量,这里可随意更改
   
      public function __construct($total,$pagesize,$_cur_page)
        {   
        $this->_total=$total;
        $this->pagesize=$pagesize;
        $this->_offset();
        $this->_pager();
        $this->cur_page($_cur_page);
        $this->link();
    }
   
    public  function _pager()//计算总页数
    {
    return $this->pages = ceil($this->_total/$this->pagesize);
    }
   
   
    public function cur_page($_cur_page) //设置页数
    {     
               if (isset($_cur_page))
           {
           $this->_cur_page=intval($_cur_page);
           }
           else
           {
            $this->_cur_page=1; //设置为第一页
           }
        return  $this->_cur_page;
   }
   
//数据库记录偏移量
   public function _offset()
   {
   return $this->offset=$this->pagesize*($this->_cur_page-1);
   }
   
  //html连接的标签
  public function link()
  {
    if ($this->_cur_page == 1 && $this->pag