文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>xajax通用分页类

xajax通用分页类

时间:2006-02-24  来源:wleige

/**
** xajax通用分页类
** 适用于无刷新页面翻页
** 未提供注释,博君一笑~~
** @author : lino([email protected])
** @site :
http://www.ypren.com
** @version : 0.2
** @date : 2006/2/16
**/
class Pager{
var $url;
var $countall;
var $page;
var $thestr;
var $backstr;
var $nextstr;
var $pg;
var $content;
var $function;
var $id;
function Pager($countall,$countlist,$id,$function,$thePage){ // 参数分别为:总数,每页显示数,操作的ID,操作的方法,当前页
$this->function = $function;
$this->id = $id;
if ($thePage==0 || $thePage==""){
$thePage = 1;
}
$this->pg = $thePage;
$this->countall = $countall;
if ($this->countall%$countlist!=0){
$this->page=sprintf("%d",$this->countall/$countlist)+1;
}
else{
$this->page=$this->countall/$countlist;
}
if ($this->pagepage+1;$i++){
$this->thestr=$this->thestr.Pager::makepg($i,$this->pg);
}
}
else{
if ($this->pgthestr=$this->thestr.Pager::makepg($i,$this->pg);
}
}
else{
if (6+$this->pgpage){
for ($i=$this->pg-4;$ipg+6;$i++){
$this->thestr=$this->thestr.Pager::makepg($i,$this->pg);
}
}
else{
for ($i=$this->pg-4;$ipage+1;$i++){
$this->thestr=$this->thestr.Pager::makepg($i,$this->pg);
}
}
}
}
$this->backstr = Pager::gotoback($this->pg);
$this->nextstr = Pager::gotonext($this->pg,$this->page);
$this->content = $this->backstr.$this->thestr.$this->nextstr." 共".$this->countall." 条,每页".$countlist."条,分".$this->page."页 当前第".$thePage."页";
return $this->content;
}
function makepg($i,$pg){
if ($i==$pg){
return " ".$i."";
}
else{
return "
".$i."
";
}
}
function gotoback($pg){
if ($pg-1>0){
$pg = $pg-1;
return $this->gotoback="
首页
function($this->id,".$pg.")' href="http://www.phpx.com/pth110866.php#">上页";
}
else{
return $this->gotoback="";
}
}
function gotonext($pg,$page){
if ($pg function($this->id,".$pg.")' href="http://www.phpx.com/pth110866.php#">下页
尾页
";
}
else{
return "";
}
}
}
?>

相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载