帝国CMS列表的分页导航标签show.listpage样式优化

帝国CMS的分页导航(列表式)[!--show.listpage--]默认的样式没达到自己的需求,自己调整了一下。

修改class/t_functions.php,替换行100~169(7.5版本。其他版本可能不同行)

//列表模板之列表式分页
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">&nbsp;<b>'.$num.'</b> </a>&nbsp;&nbsp;';
    //上一页
    if($page<>1)
    {
        $toppage='<a href="'.$dolink.$add['dofile'].$type.'">'.$fun_r['startpage'].'</a>';
        $pagepr=$page-1;
        if($pagepr1)
        {
            $prido=$add[&#039;dofile&#039;].$type;
        }
        else
        {
            $prido=$add[&#039;dofile&#039;].&#039;_&#039;.$pagepr.$type;
        }
        $prepage=&#039;&lt;a href=&quot;&#039;.$dolink.$prido.&#039;&quot;&gt;&#039;.$fun_r[&#039;pripage&#039;].&#039;&lt;/a&gt;&#039;;
    }
    //下一页
    if($page!=$totalpage)
    {
        $pagenex=$page+1;
        $nextpagelink=$repagenum&amp;&amp;$repagenum&lt;$pagenex?eReturnRewritePageLink2($add,$pagenex):$dolink.$add[&#039;dofile&#039;].&#039;_&#039;.$pagenex.$type;
        $lastpagelink=$repagenum&amp;&amp;$repagenum&lt;$totalpage?eReturnRewritePageLink2($add,$totalpage):$dolink.$add[&#039;dofile&#039;].&#039;_&#039;.$totalpage.$type;
        $nextpage=&#039;&lt;a href=&quot;&#039;.$nextpagelink.&#039;&quot;&gt;&#039;.$fun_r[&#039;nextpage&#039;].&#039;&lt;/a&gt;&#039;;
        $lastpage=&#039;&lt;a href=&quot;&#039;.$lastpagelink.&#039;&quot;&gt;&#039;.$fun_r[&#039;lastpage&#039;].&#039;&lt;/a&gt;&#039;;
    }
    $starti=$page-$snum&lt;1?1:$page-$snum;
    $no=0;
    for($i=$starti;$i&lt;=$totalpage&amp;&amp;$no&lt;$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;}

发表评论

行为验证™ 安全组件加载中...

评论 1 条

  • ComBox
    ComBox 2026-05-28 17:37 回复

    我也在用帝国CMS系统。谢谢

文章目录