Example #1
0
 /**
  * @param int $total 总条数
  * @param string $row 每页显示条数
  * @param string $pageRow 显示页码数量
  * @param string $desc 描述文字
  * @param string $setSelfPage 当前页
  * @param string $customUrl 自定义url地址
  * @param string $pageNumLabel 页码变量,默认为{page}
  */
 function __construct($total, $row = '', $pageRow = '', $desc = '', $setSelfPage = '', $customUrl = '', $pageNumLabel = '{page}')
 {
     $this->totalRow = $total;
     //总条数
     $this->arcRow = empty($row) ? C("PAGE_SHOW_ROW") : $row;
     //每页显示条数
     $this->pageRow = (empty($pageRow) ? C('PAGE_ROW') : $pageRow) - 1;
     //显示页码数量
     $this->totalPage = ceil($this->totalRow / $this->arcRow);
     //总页数
     self::$staticTotalPage = $GLOBALS['totalPage'] = $this->totalPage;
     //总页数
     self::$pageNumLabel = empty($pageNumLabel) ? self::$pageNumLabel : $pageNumLabel;
     //替换标签
     $this->selfPage = min($this->totalPage, empty($setSelfPage) ? empty($_GET[C("PAGE_VAR")]) ? 1 : max(1, (int) $_GET[C("PAGE_VAR")]) : max(1, (int) $setSelfPage));
     //当前页
     $this->url = $this->setUrl($customUrl);
     //配置url地址
     $this->startId = ($this->selfPage - 1) * $this->arcRow + 1;
     //当前页开始ID
     $this->endId = min($this->selfPage * $this->arcRow, $this->totalRow);
     //当前页结束ID
     $this->desc = $this->desc($desc);
 }