替換require/forum.php中的
function numofpage 函數
修改方法:
用以下代碼
複製程式
function numofpage($count,$page,$numofpage,$url,$max=0)
{
global $tablecolor;
$total=$numofpage;
$max && $numofpage > $max && $numofpage=$max;
if ($numofpage <= 1 || !is_numeric($page)){
$pages= "<input class=inbg type=button value='本版目前只有一頁' name=button disabled>"; return $pages;
}else{
$pages="<input class=inbg type=button value='首頁' onClick=\"location.href='{$url}page=1'\" name=button title='回到第一頁'>";
$flag=0;
for($i=$page-3;$i<=$page-1;$i++)
{
if($i<1) continue;
if($i<10){
$pages.=" <input class=inbg type=button value=' $i ' onClick=\"location.href='{$url}page=$i'\" name=button>";}
else{
$pages.=" <input class=inbg type=button value='$i' onClick=\"location.href='{$url}page=$i'\" name=button>";}
}
if($page<10){
$pages.=" <input class=inbg type=button value=' $page ' name=button disabled>";}
else{$pages.=" <input class=inbg type=button value='$page' name=button disabled>";}
if($page<$numofpage)
{
for($i=$page+1;$i<=$numofpage;$i++)
{
if($i<10){
$pages.=" <input class=inbg type=button value=' $i ' onClick=\"location.href='{$url}page=$i'\" name=button>";}
else{$pages.=" <input class=inbg type=button value='$i' onClick=\"location.href='{$url}page=$i'\" name=button>";}
$flag++;
if($flag==4) break;
}
}
$pages.=" <input class=inbg type=button value='尾頁' onClick=\"location.href='{$url}page=$numofpage'\" name=button title='最後一頁'> <input type='text' size=ƈ' style='height: 18px; border:1px solid $tablecolor' onkeydown=\"javascript: if(event.keyCode==13) location='{$url}page='+this.value;\"> 總共:(<font color=red>$page</font>/$total)";
return $pages;
}
}