<!--數字分頁開始html上面-->
<?php
# BuildNav for
Dreamweaver MX v0.2
# 10-02-2002
# Alessandro
Crugnola [TMM]
# sephiroth:
alessandro@sephiroth.it
#
http://www.sephiroth.it
#
# Function for
navigation build ::
function
buildNavigation($pageNum_productRec,$totalPages_productRec,$prev_productRec,$next_productRec,$separator="
| ",$max_links=10, $show_page=true)
{
GLOBAL
$maxRows_productRec,$totalRows_productRec;
$pagesArray = ""; $firstArray =
""; $lastArray = "";
if($max_links<2)$max_links=2;
if($pageNum_productRec<=$totalPages_productRec
&& $pageNum_productRec>=0)
{
if ($pageNum_productRec >
ceil($max_links/2))
{
$fgp = $pageNum_productRec -
ceil($max_links/2) > 0 ? $pageNum_productRec - ceil($max_links/2) : 1;
$egp = $pageNum_productRec +
ceil($max_links/2);
if ($egp >= $totalPages_productRec)
{
$egp = $totalPages_productRec+1;
$fgp = $totalPages_productRec -
($max_links-1) > 0 ? $totalPages_productRec
- ($max_links-1) : 1;
}
}
else {
$fgp = 0;
$egp = $totalPages_productRec >=
$max_links ? $max_links : $totalPages_productRec+1;
}
if($totalPages_productRec >= 1) {
# ------------------------
# Searching for $_GET vars
# ------------------------
$_get_vars = '';
if(!empty($_GET) || !empty($HTTP_GET_VARS)){
$_GET = empty($_GET) ? $HTTP_GET_VARS :
$_GET;
foreach ($_GET as $_get_name =>
$_get_value) {
if ($_get_name !=
"pageNum_productRec") {
$_get_vars .= "&$_get_name=$_get_value";
}
}
}
$successivo = $pageNum_productRec+1;
$precedente = $pageNum_productRec-1;
$firstArray = ($pageNum_productRec > 0) ?
"<a
href=\"$_SERVER[PHP_SELF]?pageNum_productRec=$precedente$_get_vars\">$prev_productRec</a>"
: "$prev_productRec";
# ----------------------
# page numbers
# ----------------------
for($a = $fgp+1; $a <= $egp; $a++){
$theNext = $a-1;
if($show_page)
{
$textLink = $a;
} else {
$min_l = (($a-1)*$maxRows_productRec) + 1;
$max_l = ($a*$maxRows_productRec >=
$totalRows_productRec) ? $totalRows_productRec : ($a*$maxRows_productRec);
$textLink = "$min_l - $max_l";
}
$_ss_k = floor($theNext/26);
if ($theNext != $pageNum_productRec)
{
$pagesArray .= "<a
href=\"$_SERVER[PHP_SELF]?pageNum_productRec=$theNext$_get_vars\">";
$pagesArray .=
"$textLink</a>" . ($theNext < $egp-1 ? $separator :
"");
} else {
$pagesArray .= "$textLink" . ($theNext < $egp-1 ? $separator :
"");
}
}
$theNext = $pageNum_productRec+1;
$offset_end = $totalPages_productRec;
$lastArray = ($pageNum_productRec <
$totalPages_productRec) ? "<a
href=\"$_SERVER[PHP_SELF]?pageNum_productRec=$successivo$_get_vars\">$next_productRec</a>"
: "$next_productRec";
}
}
return
array($firstArray,$pagesArray,$lastArray);
}
?>
<!--數字分頁結束-->
<!--數字分頁開始產品下面-->
<table style="border:0px solid
red;" width="670" border="0" cellspacing="0"
cellpadding="0">
<tr>
<td align="left" valign="bottom">
<?php
# variable
declaration
$prev_productRec = "« 上一頁";
$next_productRec =
"下一頁 »";
$separator =
" | ";
$max_links = 10;
$pages_navigation_productRec
=
buildNavigation($pageNum_productRec,$totalPages_productRec,$prev_productRec,$next_productRec,$separator,$max_links,true);
print
$pages_navigation_productRec[0];
?>
<?php print
$pages_navigation_productRec[1]; ?> <?php print
$pages_navigation_productRec[2]; ?></td>
<td style="border:0px solid
blue;" width="200"> <span
style="float:right">記錄 <?php
echo ($startRow_productRec + 1) ?> 到 <?php
echo min($startRow_productRec + $maxRows_productRec, $totalRows_productRec)
?> 共 <?php echo $totalRows_productRec ?>筆</span>
</td>
</table>
<!--數字分頁結束-->
將productRec換成其他變數如BlogRec
productRec 》》BlogRec
響應式網頁架站只要6,888元起|[RWD]響應式網站,自適應網頁,讓SEO搜尋引擎最佳化你的網站
"你是獵人還是獵物?"
0 comments :
張貼留言
1.猛甲茶道,歡迎多留言,可以幫自己網站打廣告~
2.需要 猛甲茶道 回覆,請勿使用匿名留言[可使用名稱/網址,名稱填自己名字,若無網址,請填E-mail]。
3.匿名攻訐、不相干之廣告適用於無條件刪去法,望請海涵:)
4.您可以使用一些 HTML 標記,如:
<b>粗體</b>, <i>斜體</i>, <a href='網址'>描述文字</a>