============================
HACK名称:仿D4美化页数显示
==========================
适用版本:Discuz! 2.5F
插件作者:大C,hfchq(ps:我只是把他拿来用)
技术支持:http://www.cntw.org
修改文件:include/global.php css.htm
安装难易:简
演示:http://bbs.cntw.org
仿D4风格下载
http://bbs.cntw.org/viewthread.php?tid=608&fpage=1
美化页数显示
修改 css.htm 模板在</style>前加入
用我改的模板的不用加了,只要修改include/global.php就行
- .tableborder { background: #D6E0EF; border: {BORDERWIDTH}px solid {BORDERCOLOR} }
复制代码
修改 include/global.php
查找
- function multi($num, $perpage, $curr_page, $mpurl) {
- $multipage = '';
- if($num > $perpage) {
- $page = 10;
- $offset = 2;
- $pages = ceil($num / $perpage);
- $from = $curr_page - $offset;
- $to = $curr_page + $page - $offset - 1;
- if($page > $pages) {
- $from = 1;
- $to = $pages;
- } else {
- if($from < 1) {
- $to = $curr_page + 1 - $from;
- $from = 1;
- if(($to - $from) < $page && ($to - $from) < $pages) {
- $to = $page;
- }
- } elseif($to > $pages) {
- $from = $curr_page - $pages + $to;
- $to = $pages;
- if(($to - $from) < $page && ($to - $from) < $pages) {
- $from = $pages - $page + 1;
- }
- }
- }
- $multipage .= '<a href="'.$mpurl.'&page=1"><<</a> ';
- for($i = $from; $i <= $to; $i++) {
- if($i != $curr_page) {
- $multipage .= '<a href="'.$mpurl.'&page='.$i.'">['.$i.']</a> ';
- } else {
- $multipage .= '<u><b>['.$i.']</b></u> ';
- }
- }
- $multipage .= $pages > $page ? " ... <a href="$mpurl&page=$pages"> [$pages] >></a>" : " <a href="$mpurl&page=$pages">>></a>";
- }
- return $multipage;
- }
复制代码
换成
- function multi($num, $perpage, $curpage, $mpurl, $maxpages = 0) {
- $mpurl .= strpos($mpurl, '?') ? '&' : '?';
- if($num > $perpage) {
- $page = 10;
- $offset = 2;
- $realpages = ceil($num / $perpage);
- $pages = $maxpages && $maxpages < $realpages ? $maxpages : $realpages;
-
- $from = $curpage - $offset;
- $to = $curpage + $page - $offset - 1;
- if($page > $pages) {
- $from = 1;
- $to = $pages;
- } else {
- if($from < 1) {
- $to = $curpage + 1 - $from;
- $from = 1;
- if(($to - $from) < $page && ($to - $from) < $pages) {
- $to = $page;
- }
- } elseif($to > $pages) {
- $from = $curpage - $pages + $to;
- $to = $pages;
- if(($to - $from) < $page && ($to - $from) < $pages) {
- $from = $pages - $page + 1;
- }
- }
- }
- $multipage = ($curpage - $offset > 1 && $pages > $page ? '<td> <a href="'.$mpurl.'page=1"><b>|</b>< </td>' : '').
- ($curpage > 1 ? '<td> <a href="'.$mpurl.'page='.($curpage - 1).'"><</a> </td>' : '');
- for($i = $from; $i <= $to; $i++) {
- $multipage .= $i == $curpage ? '<td bgcolor="'.ALTBG2.'"> <u><b>'.$i.'</b></u> </td>' :
- '<td> <a href="'.$mpurl.'page='.$i.'">'.$i.'</a> </td>';
- }
- $multipage .= ($curpage < $pages ? '<td> <a href="'.$mpurl.'page='.($curpage + 1).'">></a> </td>' : '').
- ($curpage + $page - $offset <= $pages ? '<td> <a href="'.$mpurl.'page='.$pages.'">><b>|</b></a> </td>' : '').
- ($curpage == $maxpages ? '<td> <a href="misc.php?action=maxpages&pages='.$maxpages.'">><b>?</b></a> </td>' : '').
- ($pages > $page ? '<td><input type="text" name="custompage" size="2" style="border: 1px solid '.BORDERCOLOR.'" onKeyDown="javascript: if(window.event.keyCode == 13) window.location=\''.$mpurl.'page=\'+this.value;"></td>' : '');
- $multipage = $multipage ? '<table cellspacing="0" cellpadding="0" border="0"><tr><td height="3"></td></tr><tr><td>'.
- '<table cellspacing="'.BORDERWIDTH.'" cellpadding="0" class="tableborder"><tr bgcolor="'.ALTBG1.'" class="smalltxt"><td class="header"> '.$num.' </td><td class="header"> '.$curpage.'/'.$realpages.' </td>'.$multipage.'</tr></table>'.
- '</td></tr><tr><td height="3"></td></tr></table>' : '';
- }
- return $multipage;
- }
复制代码
[ Last edited by qzchq on 2005-1-5 at 00:46 ] |