<?php
/**
+------------------------------------------------------------------------------
* Framk
+------------------------------------------------------------------------------
* @package Lib
* @author hifan <helofan@163.com>
* @version 0.1
+------------------------------------------------------------------------------
*/
class PageStatic{
private $pageSize;
private $currentPage;
private $totalPage;
private $subUrl;
private $totalRecord;
private $htmlPage;
private $ext=''
public function __construct($params){
$this->totalRecord=$params[0]; $this->pageSize=$params[1]; $this->currentPage=$params[2]; $this->subUrl=$params[3]; (count($params)>4)?$this->ext=$params[4]:$this->ext= ''
$this->createPage();
}
public function createPage(){
if($this->totalRecord==0){
$this->htmlPage="" }else{
if(empty($this->currentPage)==true || is_numeric($this->currentPage)==false){
$this->currentPage=1;
}else{
$this->currentPage=intval($this->currentPage);
}
if($this->totalRecord<$this->pageSize){
$this->totalPage=1;
}else{
if($this->totalRecord%$this->pageSize==0){
$this->totalPage=intval($this->totalRecord/$this->pageSize);
}else{
$this->totalPage=intval($this->totalRecord/$this->pageSize)+1;
}
}
$this->htmlPage=$this->showPage();
return $this->htmlPage;
}
}
?>