/前台分页
function pagejhc($num,$line,$page_line,$start,$page,$search){
global $fun_r;
$fun_r['nextpage']='>';
$fun_r['pripage']='<';
$fun_r['startpage']='1';
if($num<=$line)
{
return '';
}
$search=RepPostStr($search,1);
$url=eReturnSelfPage(0).'?page';
$snum=4;//最小页数
$totalpage=ceil($num/$line);//取得总页数
$fun_r['lastpage']=$totalpage;
//$firststr='<a title="'.$fun_r['trecord'].'"> <b>'.$num.'</b> </a> ';
$firststr='';
//上一页
if($page==0)
{
$toppage='<span class="laypage_curr">'.$fun_r['startpage'].'</span> ';
// if($page-$snum>2)$toppage.='..';
// $pagepr=$page-1;
// $prepage='<a href="'.$url.'='.$pagepr.$search.'">'.$fun_r['pripage'].'</a>';
}
if($page<>0)
{
$toppage='<a href="'.$url.'=0'.$search.'">'.$fun_r['startpage'].'</a> ';
if($page-$snum>2)$toppage.='..';
$pagepr=$page-1;
$prepage='<a href="'.$url.'='.$pagepr.$search.'" class="laypage_prev">'.$fun_r['pripage'].'</a>';
}
$lastpage=$page+1==$totalpage?'<span class="laypage_curr">'.$fun_r['lastpage'].'</span> ':' <a href="'.$url.'='.($totalpage-1).$search.'">'.$fun_r['lastpage'].'</a>';
if($page+$snum<$totalpage-2)$lastpage='..'.$lastpage;
$snum=$totalpage-$page<$snum?2*$snum-$totalpage+$page:$snum;
$starti=$page-$snum<0?0:$page-$snum;
$no=0;
for($i=$starti;$i<$totalpage&&$no<$page_line;$i++)
{
$no++;
if($i==0)continue;
if($i==$totalpage-1)continue;
if($page==$i)
{
$is_1="<span class="laypage_curr">";
$is_2="</span>";
}
else
{
$is_1='<a href="'.$url.'='.$i.$search.'">';
$is_2="</a>";
}
$pagenum=$i+1;
$returnstr.=" ".$is_1.$pagenum.$is_2;
}
// $returnstr=$firststr.$toppage.$prepage.$returnstr.$nextpage.$lastpage;
$returnstr=$prepage.$firststr.$toppage.$returnstr.$lastpage.$nextpage;
return $returnstr;
}
|