相思资源网 Design By www.200059.com

复制代码 代码如下:
/**
* 显示样式2
*/
function multi($mpurl,$page = 10) {

$multipage = '';
$mpurl .= strpos($mpurl, '?') ? '&' : '?';
$realpages = 1;
if($this->infocount > $this->items) {
$offset = 2;

$realpages = @ceil($this->infocount / $this->items);
$pages = $this->maxpages && $this->maxpages < $realpages ? $this->maxpages : $realpages;

if($page > $pages) {
$from = 1;
$to = $pages;
} else {
$from = $this->pageno - $offset;
$to = $from + $page - 1;
if($from < 1) {
$to = $this->pageno + 1 - $from;
$from = 1;
if($to - $from < $page) {
$to = $page;
}
} elseif($to > $pages) {
$from = $pages - $page + 1;
$to = $pages;
}
}

$multipage = ($this->pageno - $offset > 1 && $pages > $page ? '<a href="'.$mpurl.'page=1" class="first">1 ...</a>' : '').
($this->pageno > 1 ? '<a href="'.$mpurl.'page='.($this->pageno - 1).'" class="p_redirect"><<</a>' : '');
for($i = $from; $i <= $to; $i++) {
$multipage .= $i == $this->pageno ? '<a class="p_curpage"><strong>'.$i.'</strong></a>' :'<a href="'.$mpurl.'page='.$i.'" class="p_num">'.$i.'</a>';
}

$multipage .= ($this->pageno < $pages ? '<a href="'.$mpurl.'page='.($this->pageno + 1).'" class="p_redirect"></a>' : '').
($to < $pages ? '<a href="'.$mpurl.'page='.$pages.'" class="last">... '.$realpages.'</a>' : '').
($pages > $page ? '<kbd><input type="text" name="custompage" size="3" onkeydown="if(event.keyCode==13) {window.location=\''.$mpurl.'page=\'+this.value; return false;}" /></kbd>' : '');

$multipage = $multipage ? '<div class="p_bar"><a class="p_total"> '.$this->infocount.' </a><a class="p_pages"> '.$this->pageno.'/'.$pages.' </a>'.$multipage.'</div>' : '';
}
return $multipage;
}

这是效果:
图片附件:
php仿discuz分页效果代码

标签:
php,discuz,分页

相思资源网 Design By www.200059.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
相思资源网 Design By www.200059.com

评论“php仿discuz分页效果代码”

暂无php仿discuz分页效果代码的评论...