代码如下:
PHP /**
* 功能:分页类
* 作者:PHPox
* 时间:Sat Jul 14 18:15:02 CST 2007
*/ defined('PHPOX') or die(header("HTTP/1.1 403 Not Forbidden")); class page{
public $infocount;
public $pagecount;
public $items;
public $pageno;
public $start;
public $next;
public $prev;
public $maxpages; public function __construct($infocount,$items,$pageno){
$this->infocount = $infocount;
$this->items = $items;
$this->pageno = $pageno;
$this->pagecount = $this->getpagecount();
$this->justpageno();
$this->start = $this->getstart();
$this->gotoprev();
$this->gotonext();
} private function justpageno(){
if (emptyempty($this->pageno) || $this->pageno < 1){
$this->pageno = 1;
}
if ($this->pageno > $this->pagecount){
$this->pageno = $this->pagecount;
}
} private function gotonext(){
$next = $this->pageno + 1;
if ($next > $this->pagecount){
$this->next = $this->pagecount;
}else {
$this->next = $next;
} } private function gotoprev(){
$prev = $this->pageno -1;
if ($prev < 1){
$this->prev = 1;
}else {
$this->prev = $prev;
}
} private function getpagecount(){
return ceil($this->infocount / $this->items);
} private function getstart(){
if ($this->pageno <= 1){
return 0;
}else {
return ($this->pageno - 1) * $this->items;
}
} /**
* 样式0(PHP)
*/
public function showpage($ctlname,$actname,$args = null){
if ($args !== null){
if (is_array($args)){
$str = '&'.encode_url_args($args);
}
}
$out = '';
$out .= "每页显示{$this->items}条信息 ";
$out .= "当前页
$out .= "共有{$this->infocount}条信息 ";
$out .= "首页 ";
$out .= "上一页 ";
$out .= "下一页 ";
$out .= "尾页 ";
$out .= "跳转到:";
$out .= "
* 功能:分页类
* 作者:PHPox
* 时间:Sat Jul 14 18:15:02 CST 2007
*/ defined('PHPOX') or die(header("HTTP/1.1 403 Not Forbidden")); class page{
public $infocount;
public $pagecount;
public $items;
public $pageno;
public $start;
public $next;
public $prev;
public $maxpages; public function __construct($infocount,$items,$pageno){
$this->infocount = $infocount;
$this->items = $items;
$this->pageno = $pageno;
$this->pagecount = $this->getpagecount();
$this->justpageno();
$this->start = $this->getstart();
$this->gotoprev();
$this->gotonext();
} private function justpageno(){
if (emptyempty($this->pageno) || $this->pageno < 1){
$this->pageno = 1;
}
if ($this->pageno > $this->pagecount){
$this->pageno = $this->pagecount;
}
} private function gotonext(){
$next = $this->pageno + 1;
if ($next > $this->pagecount){
$this->next = $this->pagecount;
}else {
$this->next = $next;
} } private function gotoprev(){
$prev = $this->pageno -1;
if ($prev < 1){
$this->prev = 1;
}else {
$this->prev = $prev;
}
} private function getpagecount(){
return ceil($this->infocount / $this->items);
} private function getstart(){
if ($this->pageno <= 1){
return 0;
}else {
return ($this->pageno - 1) * $this->items;
}
} /**
* 样式0(PHP)
*/
public function showpage($ctlname,$actname,$args = null){
if ($args !== null){
if (is_array($args)){
$str = '&'.encode_url_args($args);
}
}
$out = '';
$out .= "每页显示{$this->items}条信息 ";
$out .= "当前页
pageno}/{$this->pagecount}
";$out .= "共有{$this->infocount}条信息 ";
$out .= "首页 ";
$out .= "上一页 ";
$out .= "下一页 ";
$out .= "尾页 ";
$out .= "跳转到:";
$out .= "