PHP经典分页导航函数

预览
pre


#*********************************************************
#分页函数
#*********************************************************
function yl_list_page($pageurl,$rsnum,$pages,$pagecount,$pagesize){
#url
#总记录
#总页数
#当前页码
#每页显示数
//$pageurl=’?’;
$pcount = $pages;
$page_info = ‘

‘;
$page_info .= ‘

‘;
if (($pcount > 1) && ($pcount == $pagecount) ){
$page_info .= ‘上一页‘;
}elseif (($pagecount != 1) && ($pcount != $pagecount)){
$page_info .= ‘上一页‘;
}
$page_info .= ‘页首‘;
if ($pagecount > 4){
$page_info .= ‘[1]‘;
}
if ($pcount > $pagecount+2){
$endpage = $pagecount+2;
}else{
$endpage = $pcount;
}
for ($n = ($pagecount-2); $n <= $endpage; $n++){ if (!($n < 1)){ if ($n == intval($pagecount)){ $page_info .= '‘.$n.’‘;
}else{
$page_info .= ‘[‘.$n.’]‘;
}
}
}
if ($pagecount+2 < $pcount){ $page_info .= '[‘.$pcount.’]‘;
}
$page_info .= ‘页尾‘;
if (($pagecount == 1) && ($pcount != $pagecount) && ($pcount != 0)){
$page_info .= ‘下一页‘;
}else if (($pagecount != 1) && ($pcount != $pagecount)){
$page_info .= ‘下一页‘;
}
$page_info .= ‘

‘;
$page_info .= ‘

‘;
$page_info .= ‘

共:’.$rsnum .’条/’.$pcount.’页 每页/’.$pagesize.’条

‘;
$page_info .= ‘

‘;
//echo ‘

‘;
$page_info .= ‘ 转到’;
$page_info .= ‘‘;
$page_info .= ‘页 ‘;
//echo ‘

‘;
$page_info .= ‘

‘;
$page_info .= ‘

‘;
return $page_info;
}

CSS样式:


/*page*/
.pagenum {
clear: both; width: ‘100%’;padding-right: 5px; padding-left: 0px; font-weight: bold; padding-bottom: 0px; overflow: hidden; color: #6396d6; padding-top: 0px; height: 25px;
}
.pagenum .num {
float: right;
}
.pagenum .normal {
background: #f7fbff;color: #6396d6; float: left; padding-bottom: 2px; margin: 0px 3px 0px 0px; padding-top: 3px;border-left: #6396d6 1px solid; border-right: #6396d6 1px solid;padding-right: 5px; padding-left: 5px; border-top: #6396d6 1px solid;border-bottom: #6396d6 1px solid;
}
.pagenum .dot {
float: left;color: #6396d6;
}
.pagenum a {
background: #298ac6; color: #fff; float: left; padding-bottom: 2px; margin: 0px 3px 0px 0px; padding-top: 3px;border-left: #6396d6 1px solid; border-right: #6396d6 1px solid;padding-right: 5px; padding-left: 5px; border-top: #6396d6 1px solid;border-bottom: #6396d6 1px solid;
}
.pagenum a:visited {
color: #fff;
}
.pagenum a:hover {
background: #f7fbff;color: #6396d6;border-left: #6396d6 1px solid; border-right: #6396d6 1px solid;border-top: #6396d6 1px solid;border-bottom: #6396d6 1px solid;
}

留下评论

您的电子邮箱地址不会被公开。 必填项已用 * 标注

66 − 65 =