帝国CMS列表的分页导航标签show.listpage样式优化
帝国CMS的分页导航(列表式)[!--show.listpage--]默认的样式没达到自己的需求,自己调整了一下。
修改class/t_functions.php,替换行100~169(不同版本可能不同行)
//列表模板之列表式分页
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'];
$snum=2;
//$totalpage=ceil($num/$line);//取得总页数
//$firststr='<a title="Total record"> <b>'.$num.'</b> </a> ';
//上一页
if($page<>1)
{
$toppage='<a href="'.$dolink.$add['dofile'].$type.'">'.$fun_r['startpage'].'</a>';
$pagepr=$page-1;
if($pagepr==1)
{
$prido=$add['dofile'].$type;
}
else
{
$prido=$add['dofile'].'_'.$pagepr.$type;
}
$prepage='<a href="'.$dolink.$prido.'">'.$fun_r['pripage'].'</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.'">'.$fun_r['nextpage'].'</a>';
$lastpage='<a href="'.$lastpagelink.'">'.$fun_r['lastpage'].'</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="cur">';
$is_2="</span>";
}
elseif($i==1)
{
$is_1='<a href="'.$dolink.$add['dofile'].$type.'">';
$is_2="</a>";
}
else
{
$thispagelink=$repagenum&&$repagenum<$i?eReturnRewritePageLink2($add,$i):$dolink.$add['dofile'].'_'.$i.$type;
$is_1='<a href="'.$thispagelink.'">';
$is_2="</a>";
}
$returnstr.=''.$is_1.$i.$is_2;
}
$returnstr=$firststr.$toppage.$prepage.$returnstr.$nextpage.$lastpage;
$pager['showpage']=$returnstr;
return $pager;
}下面是自己常用的CSS样式:
.listpage{margin-top:30px;text-align:center;clear:both;height:40px;line-height:40px;font-size:16px;}
.listpage a{color:#d00;margin-right:8px;text-decoration:none;padding:6px 12px;border:1px solid #eee;border-radius:4px;}
.listpage a:hover{color:#d00;background-color:#f5f5f5;text-decoration:none;border:1px solid #d00;}
.listpage a:active{color:#d00;background-color:#f5f5f5;border:1px solid #666;}
.listpage span.cur{font-weight:bold;color:#fff;margin-right:8px;background:#d00;border:1px solid #d00;padding:6px 12px;border-radius:4px;}
.listpage span.disabled{color:#eee;margin-right:8px;border:1px solid #f3f3f3;padding:6px 12px;border-radius:4px;} Copyright Notice: This article is an original work. Copyright belongs to A君博客. Please contact the author for permission before reprinting.
Article URL: https://nipang.cn/ecms-showlistpage.html
If you have any questions or concerns about this article, feel free to leave a comment. I will try my best to respond as soon as possible.