您现在的位置是:首页 > 分享首页分享

记帝国CMS列表页翻页样式自定义

  • 分享
  • 2020-04-17 17:58:23
  • 1已阅读
帝国CMS列表页翻页样式一直处理不好,后来整理了一套方法,一直沿用中。
先来看下最终效果:
具体操作方法如下:

第一步:找到 e/class/userfun.php之间插入下面代码
function user_ShowListMorePage($num,$page,$dolink,$type,$totalpage,$line,$ok,$search=""){
    global $fun_r,$public_r;
    if($num<=$line)
    {
        $pager['showpage']='';
        return $pager;
    }
    $page_line=$public_r['listpagelistnum'];
    $snum=2;
 
    //上一页
    if($page<>1)
    {
        $toppage='<a href="'.$dolink.'index'.$type.'" class="disabled">'.$fun_r['startpage'].'</a>';    //首页
        $pagepr=$page-1;
        if($pagepr==1)
        {
            $prido="index".$type;
        }
        else
        {
            $prido="index_".$pagepr.$type;
        }
        $prepage='<a href="'.$dolink.$prido.'" class="disabled">'.$fun_r['pripage'].'</a>';     //上一页
    }
    //下一页
    if($page!=$totalpage)
    {
        $pagenex=$page+1;
        $nextpage='<a href="'.$dolink.'index_'.$pagenex.$type.'" class="disabled">'.$fun_r['nextpage'].'</a>';   //下一页
        $lastpage='<a href="'.$dolink.'index_'.$totalpage.$type.'" class="disabled">'.$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="<a class='cur'>";    //当前
            $is_2="</a>";
        }
        elseif($i==1)
        {
            $is_1='<a href="'.$dolink.'index'.$type.'">';   //第一页
            $is_2="</a>";
        }
        else
        {
            $is_1='<a href="'.$dolink.'index_'.$i.$type.'">';    //其他页
            $is_2="</a>";
        }
        $returnstr.=$is_1.$i.$is_2;
    }
    $returnstr=$firststr.$toppage.$prepage.$returnstr.$nextpage.$lastpage; 
    $pager['showpage']=$returnstr;
    return $pager;
}

第二步:进入帝国cms后台,点击系统设置->系统参数设置->信息设置:里面有个"列表分页函数(列表)"选项,将里面的函数名修改为user_ShowListMorePage

第三步:在你的列表页中写上分页就好了[!--show.listpage--]
<div class="pageBox pTB20">[!--show.listpage--]</div>

第四步:在主控CSS页面中加入一下代码(喜欢什么颜色、尺寸自己修改即可)
CSS代码
/*** page
-------------------------------------------------------------- ****/
.pageBox {text-align: center;}
.pageBox a {border:1px solid #ddd;display:inline-block;margin-right:6px;color: #707070;width:34px;height:34px;font:bold 14px/34px arial;}
.pageBox a:hover,.pageBox a:active{background:#3aa9f2;color: #FFFFFF;text-decoration: none;}
.pageBox .cur { background: #3aa9f2;border: 1px solid #3aa9f2;text-decoration: none;}
.pageBox a.cur {color: #fff;}
.pageBox .disabled {width: 79px;}

第五步:更新缓存,刷新列表,大功告成。  

文章评论

Top