目前修改的这个程序只对静态的起作用,对动态的不作用,动态的请往下看
找到e/class/t_functions.php
找到function sys_ShowListMorePage把它注释掉,再加上下面的代码
//列表模板之列表式分页
function sys_ShowListMorePage($num,$page,$dolink,$type,$totalpage,$line,$ok,$search="",$add){
global $fun_r,$public_r;
if($num<=$line)
{
$pager['showpage']='';
return $pager;
}
//文件名
if(empty($add['dofile']))
{
$add['dofile']='index';
}
//静态页数
$repagenum=$add['repagenum'];
//$page_line=$public_r['listpagelistnum'];
$page_line=7;
$snum=3;
//$totalpage=ceil($num/$line);//取得总页数
$firststr='<span>共'.$num.'条</span>';
$everypage = '<span>每页'.$line.'条</span>';
$pageyeci = '<span>页次 '.$page.'/'.$totalpage.'</span>';
//上一页
if($page<>1)
{
$toppage='<a href="'.$dolink.$add['dofile'].$type.'"><span>'.$fun_r['startpage'].'</span></a>';
$pagepr=$page-1;
if($pagepr==1)
{
$prido=$add['dofile'].$type;
}
else
{
$prido=$add['dofile'].'_'.$pagepr.$type;
}
$prepage='<a href="'.$dolink.$prido.'"><span>'.$fun_r['pripage'].'</span></a>';
}
//下一页
if($page!=$totalpage)
{
$pagenex=$page+1;
$nextpagelink=$repagenum&&$repagenum<$pagenex?eReturnRewritePageLink2($add,$pagenex):$dolink.$add['dofile'].'_'.$pagenex.$type;
$lastpagelink=$repagenum&&$repagenum<$totalpage?eReturnRewritePageLink2($add,$totalpage):$dolink.$add['dofile'].'_'.$totalpage.$type;
$nextpage='<a href="'.$nextpagelink.'"><span>'.$fun_r['nextpage'].'</span></a>';
$lastpage='<a href="'.$lastpagelink.'"><span>'.$fun_r['lastpage'].'</span></a>';
}
$starti=$page-$snum<1?1:$page-$snum;
$no=0;
for($i=$starti;$i<=$totalpage&&$no<$page_line;$i++)
{
$no++;
if($page==$i)
{
$is_1="<span class='nowpage'>";
$is_2="</span>";
}
elseif($i==1)
{
$is_1='<a href="'.$dolink.$add['dofile'].$type.'"><span>';
$is_2="</span></a>";
}
else
{
$thispagelink=$repagenum&&$repagenum<$i?eReturnRewritePageLink2($add,$i):$dolink.$add['dofile'].'_'.$i.$type;
$is_1='<a href="'.$thispagelink.'"><span>';
$is_2="</span></a>";
}
$returnstr.=$is_1.$i.$is_2;
}
$returnstr="<div class='listpages'><div class='pageleft'>".$firststr.$everypage.$pageyeci."</div><div class='pageright'>".$toppage.$prepage.$returnstr.$nextpage.$lastpage."</div><div style='clear:both'></div></div>";
$pager['showpage']=$returnstr;
return $pager;
}
然后在该页面的css样式里加上下面的样式
/*如果空间够大
.listpages{}
.pageleft{ float:left; height:30px; margin-top:15px}
.pageleft span{ display:block; padding-left:10px; padding-right:10px; height:30px; line-height:30px; border:1px #CCCCCC solid; float:left; margin-left:10px;border-radius:5px; font-size:14px}
.pageright{ float:right; height:30px; margin-top:15px}
.pageright a span{ display:block;padding-left:10px; padding-right:10px; height:30px; line-height:30px; border:1px #CCCCCC solid; float:left; margin-left:10px; color:#333333; font-size:16px;border-radius:5px;}
.pageright span:hover{ background:#FF9900}
.nowpage{ display:block;padding-left:10px; padding-right:10px; height:30px; line-height:30px; border:1px #CCCCCC solid; float:left; margin-left:10px; color:#333333; font-size:16px;border-radius:5px;background:#FF9900; font-weight:bold; color:#ffffff}
*/
/*如果空间不够大*/
.listpages{}
.pageleft{ float:left; height:25px; margin-top:15px}
.pageleft span{ display:block; padding-left:6px; padding-right:6px; height:25px; line-height:25px; border:1px #CCCCCC solid; float:left; margin-left:5px;border-radius:3px; font-size:14px}
.pageright{ float:right; height:25px; margin-top:15px}
.pageright a span{ display:block;padding-left:6px; padding-right:6px; height:25px; line-height:25px; border:1px #CCCCCC solid; float:left; margin-left:5px; color:#333333; font-size:14px;border-radius:3px;}
.pageright span:hover{ background:#FF9900}
.nowpage{ display:block;padding-left:6px; padding-right:6px; height:25px; line-height:25px; border:1px #CCCCCC solid; float:left; margin-left:5px; color:#333333; font-size:14px;border-radius:3px;background:#FF9900; font-weight:bold; color:#ffffff}
如果列表页是动态的话,需要修改e/class/connect.php里面的function page1函数
改成
//前台分页
function page1($num,$line,$page_line,$start,$page,$search){
global $fun_r;
if($num<=$line)
{
return '';
}
$page_line=7;
$search=RepPostStr($search,1);
$url=eReturnSelfPage(0).'?page';
$snum=3;//最小页数
$totalpage=ceil($num/$line);//取得总页数
$firststr='<a title="'.$fun_r['trecord'].'"><span>共'.$num.'条</span> </a>';
$everypage = '<span>每页'.$line.'条</span>';
$pageyeci = '<span>页次 '.($page+1).'/'.$totalpage.'</span>';
//上一页
if($page<>0)
{
$toppage='<a href="'.$url.'=0'.$search.'"><span>'.$fun_r['startpage'].'</span></a>';
$pagepr=$page-1;
$prepage='<a href="'.$url.'='.$pagepr.$search.'"><span>'.$fun_r['pripage'].'</span></a>';
}
//下一页
if($page!=$totalpage-1)
{
$pagenex=$page+1;
$nextpage='<a href="'.$url.'='.$pagenex.$search.'"><span>'.$fun_r['nextpage'].'</span></a>';
$lastpage='<a href="'.$url.'='.($totalpage-1).$search.'"><span>'.$fun_r['lastpage'].'</span></a>';
}
$starti=$page-$snum<0?0:$page-$snum;
$no=0;
for($i=$starti;$i<$totalpage&&$no<$page_line;$i++)
{
$no++;
if($page==$i)
{
$is_1="<span class='nowpage'>";
$is_2="</span>";
}
else
{
$is_1='<a href="'.$url.'='.$i.$search.'"><span>';
$is_2="</span></a>";
}
$pagenum=$i+1;
$returnstr.=$is_1.$pagenum.$is_2;
}
$returnstr="<div class='listpages'><div class='pageleft'>".$firststr.$everypage.$pageyeci."</div><div class='pageright'>".$toppage.$prepage.$returnstr.$nextpage.$lastpage."</div><div style='clear:both'></div></div>";
return $returnstr;
}
效果如下
044c7a1485cf319ea3c6d64d874532aa.png
本文章由唐山利歌网络科技有限公司发布,如果您想转载请先联系QQ448581187,如果未经我公司同意就转载我们可能会追究您的法律责任
·关于我们·免责声明·服务条款·RSS订阅·dede168.com技术支持
Copyright © 1998-2015 All rights reserved.