function fPageCount($TotalResult,$numPerPage,$Page){
$NaviLength='10' ; //顯示數量
$showMorePageGo_Type_=0; //跳轉樣式
$int_showNumberLink_='十';
$nonLinkColor_="#999999";
$toF_="<font face=webdings title="首頁">9</font>" ;
$toP10_=" <font face=webdings title="上十頁">7</font>";
$toP1_=" <font face=webdings title="上一頁">3</font>";
$toN1_=" <font face=webdings title="下一頁">4</font>";
$toN10_=" <font face=webdings title="下十頁">8</font>";
$toL_="<font face=webdings title="最後一頁">:</font>";
$page_index = "";
$tpagecount = ceil($TotalResult/$numPerPage);
$nowCoolPage=ceil($Page/$NaviLength);
$toPage_ = $_SERVER['QUERY_STRING'];
if ( $toPage_ == '' ) {
$toPage_ = "?page=";
}else {
$toPage_ = preg_replace("/&?page=d+/", '', $toPage_);
$toPage_ = "?".$toPage_."&page=";
}
if($nowCoolPage == 1){
$page_index.="<font color=".$nonLinkColor_." title="首頁">".$toF_."</font> ";
$page_index.="<font color=".$nonLinkColor_." title="上".$int_showNumberLink_."頁">".$toP10_."</font> ";
}else{
$preRow = $Page-$NaviLength;
$page_index.="<a href=".$toPage_."1 title="首頁">".$toF_."</a> ";
$page_index.="<a href=".$toPage_.$preRow." title="上".$int_showNumberLink_."頁">".$toP10_."</a> ";
}
$upRow = $Page-1;
$downRow = $Page+1;
if ($upRow>0){
$page_index.="<a href=".$toPage_.$upRow." title="上一頁">".$toP1_."</a> ";
}else{
$page_index.="<font color=".$nonLinkColor_." title="上一頁">".$toP1_."</font> ";
}
for($i=1;$i<=$NaviLength;$i++){
$nowPage=($nowCoolPage-1)*$NaviLength+$i;
if($nowPage!=$Page){
if($nowPage<=$tpagecount){
$page_index.=" <a href=".$toPage_.$nowPage.">" .$nowPage. "</a> ";
}else{
break;
}
}else{
if($tpagecount != 1){
$page_index.="<b>".$nowPage."</b>";
}
}
}
if ($downRow <= $tpagecount){
$page_index.="<a href=".$toPage_.$downRow." title="下一頁">".$toN1_."</a> ";
}else{
$page_index.="<font color=".$nonLinkColor_." title="下一頁">".$toN1_."</font> ";
}
if($nowCoolPage == $tpagecount){
$page_index.=" <font color=".$nonLinkColor_." title="下".$int_showNumberLink_."頁">".$toN10_."</font> ";
$page_index.="<font color=".$nonLinkColor_." title="尾頁">".$toL_."</font>";
}else{
$nextRow = $Page+$NaviLength;
$theEndRow = $tpagecount;
$page_index.=" <a href=".$toPage_.$nextRow." title="下".$int_showNumberLink_."頁">".$toN10_."</a> ";
$page_index.="<a href=".$toPage_.$theEndRow." title="尾頁">".$toL_."</a>";
}
if ($showMorePageGo_Type_ ==1){
$Show_Page_i = $Page + 1 ;
if ($Show_Page_i>$tpagecount) $Show_Page_i = 1;
$page_index.=" 跳轉<input type='text' id='skip' value='' onkeyup='this.value=this.value.replace(/[^d]+/,'')' style='width:40px'/> <input type='button' value='確定' class='btn' onclick='location.href='?page='+$('skip').value+'".$toPage_."';'/>n";
}else{
$page_index.=" 跳轉:<select name='select' size='1' style='font-size: 12px' onchange='javascript:window.location.href=this.options[this.selectedIndex].value'>";
for($i=1;$i<=$tpagecount;$i++){
if($Page==$i){
$selected=" selected";
}else{
$selected="";
}
$page_index.=" <option value=".$toPage_.$i;
$page_index.=$selected." style='color:#FF0000'";
$page_index.=">第".$i."頁</option>";
}
$page_index.="</select>";
}
$page_index.=$p_.$sp2_." 每頁<b>".$numPerPage."</b>個記錄,現在是:<b><span class='tx'>".$sp2_.$Page."</span>/".$tpagecount."</b>頁,共<b><span id='recordcount'>".$sp2_.$TotalResult."</span></b>個記錄。";
return $page_index;
}
例子:<?php echo fPageCount($TotalResult,$numPerPage,$page)?> $TotalResult 代表總數 $numPerPage 每頁顯示數量 $page 頁碼