帝国cms--修改分页样式

在使用帝国cms系统时,我们用[!--show.page--]和[!--show.listpage--]来生成页码

其中[!--show.listpage--]所生成的html页码代码案例为:

帝国的分页样式在e>class>下的t_functions.php这个文件里

大概在118行找到(当前页大致在:150行)

$firststr='<div><a title="Total record">&nbsp;<b>'.$num.'</b> </a></div>&nbsp;&nbsp;';
    //上一页
    if($page<>1)
    {
        $toppage='<div><a href="'.$dolink.$add['dofile'].$type.'">'.$fun_r['startpage'].'</a></div>&nbsp;';
        $pagepr=$page-1;
        if($pagepr==1)
        {
            $prido=$add['dofile'].$type;
        }
        else
        {
            $prido=$add['dofile'].'_'.$pagepr.$type;
        }
        $prepage='<div><a href="'.$dolink.$prido.'">'.$fun_r['pripage'].'</a></div>';
    }
    //下一页
    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='&nbsp;<div><a href="'.$nextpagelink.'">'.$fun_r['nextpage'].'</a></div>';
        $lastpage='&nbsp;<div><a href="'.$lastpagelink.'">'.$fun_r['lastpage'].'</a></div>';

    }
    $starti=$page-$snum<1?1:$page-$snum;
    $no=0;
    for($i=$starti;$i<=$totalpage&&$no<$page_line;$i++)
    {
        $no++;
        if($page==$i)
        {
            $is_1="<div class='div1'>";
            $is_2="</div>";

        }
        elseif($i==1)
        {
            $is_1='<div><a href="'.$dolink.$add['dofile'].$type.'">';
            $is_2="</a></div>";

        }
        else
        {
            $thispagelink=$repagenum&&$repagenum<$i?eReturnRewritePageLink2($add,$i):$dolink.$add['dofile'].'_'.$i.$type;
            $is_1='<div><a href="'.$thispagelink.'">';
            $is_2="</a></div>";

        }
        $returnstr.='&nbsp;'.$is_1.$i.$is_2;
    }
    $returnstr=$firststr.$toppage.$prepage.$returnstr.$nextpage.$lastpage;
    $pager['showpage']=$returnstr;
    return $pager;
}


777777.png

 

<a title="Total record">&nbsp;<b>9</b> </a>&nbsp;&nbsp;

<a href="/dg/news/china/index.html">首页</a>&nbsp;

<a href="/dg/news/china/index.html">上一页</a>&nbsp;

<a href="/dg/news/china/index.html">1</a>&nbsp;

<b>2</b>&nbsp;

<a href="/dg/news/china/index_3.html">3</a>&nbsp;

<a href="/dg/news/china/index_3.html">下一页</a>&nbsp;

<a href="/dg/news/china/index_3.html">尾页</a>

现在我们来修改其样式

帝国的分页样式在e>class>下的t_functions.php这个文件里

列表页模板[!--show.listpage--]:分页导航(列表式) 在90-149行

一,总页码数

大概在118行找到$firststr='<a title="Total record">&nbsp;<b>'.$num.'</b> </a>&nbsp;&nbsp;';

比较一下

$firststr='<a title="Total record">&nbsp;<b>'.$num.'</b> </a>&nbsp;&nbsp;';

             <a title="Total record">&nbsp;<b>9</b></a>&nbsp;&nbsp;

这里也就是说明,总页码“9” 所对应的变量为 '.$num.'  $firststr 是总页码的变量名称

二,首页

我们再找到$toppage='<a href="'.$dolink.'index'.$type.'">'.$fun_r['startpage'].'</a>&nbsp;';

比较一下

 $toppage='<a href="'.$dolink.'index'.$type.'">'.$fun_r['startpage'].'</a>&nbsp;';

                 <a href="/dg/news/china/index.html">首页</a>&nbsp;

这里我们能看出来 首页所对应的“首页”代码为“'.$fun_r['startpage'].'”  其链接所对应“'.$dolink.'index'.$type.'

三.上一页

我们再找到$prepage='<a href="'.$dolink.$prido.'">'.$fun_r['pripage'].'</a>';

比较一下

$prepage='<a href="'.$dolink.$prido.'">'.$fun_r['pripage'].'</a>';

                <a href="/dg/news/china/index.html">上一页</a>&nbsp;

四,下一页和尾页

这里所对应的代码为每一页的页码标签

找到

$nextpage='&nbsp;<a href="'.$dolink.'index_'.$pagenex.$type.'">'.$fun_r['nextpage'].'</a>';
$lastpage='&nbsp;<a href="'.$dolink.'index_'.$totalpage.$type.'">'.$fun_r['lastpage'].'</a>';

这里所对应的代码为 下一页和尾页

<a href=" /dg/news/china/index_3.html">下一页</a>&nbsp;

<a href=" /dg/news/china/index_3.html">尾页</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="<b>";      
           $is_2="</b>";

       elseif($i==1)    
       {    
           $is_1='<a href="'.$dolink.$add[filename].$type.'">';        
          $is_2="</a>
";
       }    
       else    
       {    
           $is_1='<a href="'.$dolink.$add[filename].'_'.$i.$type.'">';
          $is_2=" </a>
";      
       }      
       $returnstr.='&nbsp;'.$is_1.$i.$is_2;      

1.所在页面的代码

           $is_1="<b>";      
           $is_2="</b>";

意思为所在页面标签为<b>所在页面</b>

2.所在页面之后的页码

         elseif($i==1)  
       {  
           $is_1='<a href="'.$dolink.$add[filename].$type.'">';      
          $is_2="</a>
";

意思为所在页面

为<a>之前页面</a>  

3.所在页面之后的页码

       else    
       {    
           $is_1='<a href="'.$dolink.$add[filename].'_'.$i.$type.'">';
          $is_2=" </a>
";

意思为所在页面之后的页面

为<a>之后的页面</a>

发布了59 篇原创文章 · 获赞 27 · 访问量 7万+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章