Heim  >  Artikel  >  Backend-Entwicklung  >  discuz x2.5 php仿discuz分页效果代码

discuz x2.5 php仿discuz分页效果代码

WBOY
WBOYOriginal
2016-07-29 08:38:581097Durchsuche

复制代码 代码如下:


/**
* 显示样式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 maxpages : $realpages;
if($page > $pages) {
$from = 1;
$to = $pages;
} else {
$from = $this->pageno - $offset;
$to = $from + $page - 1;
if($from $to = $this->pageno + 1 - $from;
$from = 1;
if($to - $from $to = $page;
}
} elseif($to > $pages) {
$from = $pages - $page + 1;
$to = $pages;
}
}
$multipage = ($this->pageno - $offset > 1 && $pages > $page ? '1 ...' : '').
($this->pageno > 1 ? '' : '');
for($i = $from; $i $multipage .= $i == $this->pageno ? '
'.$i.'' :''.$i.'';
}
$multipage .= ($this->pageno pageno + 1).'">>>' : '').
($to ... '.$realpages.'' : '').
($pages > $page ? '' : '');
$multipage = $multipage ? '

'.$this->infocount.' '.$this->pageno.'/'.$pages.' '.$multipage.'
' : '';
}
return $multipage;
}

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

以上就介绍了discuz x2.5 php仿discuz分页效果代码,包括了discuz x2.5方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn