• 帝国cms 列表页分页样式修改美化【2】


    上一篇(帝国cms 列表页分页样式修改美化【1】)中我们已经对分页说了一个大概,下面我们就自己动手弄一个分页把:

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

    第二部:到 e/class/userfun.php <?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;
    }
    

    第三步:在你的列表页中写上分页就好了【[!--show.listpage--]】

    =============================================================

    下面就来看看我最后的成果把

    我们在来看看代码结构

    <div class="pageBox pTB20"><a class="cur">1</a><a href="#">2</a><a href="#">3</a><a href="#">4</a><a href="#">5</a><a href="/liaotian/index_6.html">6</a><a href="#">7</a><a href="#">8</a><a href="#" class="disabled">下一页</a><a href="#" class="disabled">尾页</a></div>  
    

    下面是css代码

    /*** page
    -------------------------------------------------------------- ****/
    .pageBox {text-align: center;}
    .pageBox a {border:1px solid #ddd;display:inline-block;margin-right:6px;color: #707070;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 { 79px;}
    
  • 相关阅读:
    [转]SVN 乱码问题
    [转]自己做 Visual Studio 2013 代码折叠插件
    [Java]一步一步学 Web
    [转]SQL Server 结构读取
    [转][c#]注册表经验集
    [转]加密经验集 => C#
    [转]Oracle 连接dll
    《高效能程序员的修炼》读书笔记
    Blend for Visual Studio 2013
    ASP.NET中服务器控件的生命周期
  • 原文地址:https://www.cnblogs.com/huige728/p/3538200.html
Copyright © 2020-2023  润新知