<?php
/*****************************************************************
*功能:生成分页所需的导航条
*参数:
$total:记录总数
$currentpage:当前页码
$perpage:每页显示记录条数
$url:显示数据的网页
*返回:导航条,样式:当前显示第 1页,每页10条 | 共 13条 [首页] [前页] [后页][末页] 跳转到 1 页
*日期:2007-03-03
*作者:高西林
*版权:高西林
*修改记录:
*****************************************************************/
function pagenavigate($total,$currentpage,$perpage,$url,$joinword='?')
{
$pagename = $url;
$totalpage = ceil($total/$perpage);
$hypfirstpage = "href=/"".$pagename.$joinword."pageindex=1/"";
$hypprepage = $currentpage > 1 ? "href=/"".$pagename.$joinword."pageindex=".($currentpage-1)."/"" : " ";
$hypnextpage = $currentpage < $totalpage ? "href=/"".$pagename.$joinword."pageindex=".($currentpage+1)."/"":" ";
$hyplastpage = "href=/"".$pagename.$joinword."pageindex=".$totalpage."/"";
$navi = "<div align=/"center/">
当前显示第<font color=/"$pageindexcolor/"> <span id=lblCurrentPage>$currentpage</span></font>页,每页".$perpage."条 |
共<font color=/"$pageindexcolor/"> <span id=lblPageCount>$total</span></font>条
[<a $hypfirstpage id=hypFirst>首页</a>] [<a $hypprepage id=hypPre>前页</a>] [<a $hypnextpage id=hypPre>后页</a>][<a $hyplastpage id=hypPre>末页</a>] 跳转到
<select name='topage' size='1' οnchange='window.location=/"$url".$joinword."pageindex=/"+this.value'> ";
for($i = 1;$i <= $totalpage; $i++)
{
if($i == $currentpage )
$options .= "<option value=/"".$i."/" selected=/"selected/">".$i."</option>";
else
$options .= "<option value=/"".$i."/" >".$i."</option>";
}
$options .= "</select> 页</div>";
$navi .= $options;
return $navi;
}
?>
/*****************************************************************
*功能:生成分页所需的导航条
*参数:
$total:记录总数
$currentpage:当前页码
$perpage:每页显示记录条数
$url:显示数据的网页
*返回:导航条,样式:当前显示第 1页,每页10条 | 共 13条 [首页] [前页] [后页][末页] 跳转到 1 页
*日期:2007-03-03
*作者:高西林
*版权:高西林
*修改记录:
*****************************************************************/
function pagenavigate($total,$currentpage,$perpage,$url,$joinword='?')
{
$pagename = $url;
$totalpage = ceil($total/$perpage);
$hypfirstpage = "href=/"".$pagename.$joinword."pageindex=1/"";
$hypprepage = $currentpage > 1 ? "href=/"".$pagename.$joinword."pageindex=".($currentpage-1)."/"" : " ";
$hypnextpage = $currentpage < $totalpage ? "href=/"".$pagename.$joinword."pageindex=".($currentpage+1)."/"":" ";
$hyplastpage = "href=/"".$pagename.$joinword."pageindex=".$totalpage."/"";
$navi = "<div align=/"center/">
当前显示第<font color=/"$pageindexcolor/"> <span id=lblCurrentPage>$currentpage</span></font>页,每页".$perpage."条 |
共<font color=/"$pageindexcolor/"> <span id=lblPageCount>$total</span></font>条
[<a $hypfirstpage id=hypFirst>首页</a>] [<a $hypprepage id=hypPre>前页</a>] [<a $hypnextpage id=hypPre>后页</a>][<a $hyplastpage id=hypPre>末页</a>] 跳转到
<select name='topage' size='1' οnchange='window.location=/"$url".$joinword."pageindex=/"+this.value'> ";
for($i = 1;$i <= $totalpage; $i++)
{
if($i == $currentpage )
$options .= "<option value=/"".$i."/" selected=/"selected/">".$i."</option>";
else
$options .= "<option value=/"".$i."/" >".$i."</option>";
}
$options .= "</select> 页</div>";
$navi .= $options;
return $navi;
}
?>