您当前的位置:首页 > 帝国CMS教程

帝国CMS分页之内容叶分页效果

来源:帝国CMS教程发布者:帝国CMS模板网时间:2010-05-23

很多新手做网页,不知道怎样做分页。现在分享一下我做帝国CMS分页之内容叶分页效果的经验,希望能给大家带来一些帮助,减少一些迷茫.

<一>、

样式表:

/*分页样式2*/
.endPageNum{ padding:10px 12px 6px; clear:both; }
.endPageNum .s0{width:28px;}
.endPageNum .s1{width:52px;}
.endPageNum .s2{background:#1f3a87; border:1px solid #ccc; color:#fff; font-weight:bold;}
.endPageNum a.s2:visited {color:#fff;}
.endPageNum a{padding:4px 5px 0;margin:5px 4px 0 0; color:#1F3A87;background:#fff; display:inline-table; border:1px solid #ccc; float:left; }
.endPageNum a:visited{color:#1f3a87;}
.endPageNum a:hover{color:#fff; background:#1f3a87; border:1px solid #1f3a87;float:left;}

.endName{ padding:12px 0 0; clear:both; color:#666;}

<二>、

修改t_functions.php文件或者用附件覆盖eclass下的t_functions.php文件
//返回内容分页
function sys_ShowTextPage($totalpage,$page,$dolink,$add,$type,$search=""){
        global $fun_r,$public_r;
        if($totalpage==1)
        {
                return '';
        }
        $page_line=$public_r['textpagelistnum'];
        $snum=2;
        //$totalpage=ceil($num/$line);//取得总页数
        $firststr='<a title="Page"><b>'.$page.'</b>/<b>'.$totalpage.'</b> </a>';
        //上一页
        if($page<>1)
        {
                $toppage='<a lass="s0" href="'.$dolink.$add[filename].$type.'">'.$fun_r['startpage'].'</a>';
                $pagepr=$page-1;
                if($pagepr==1)
                {
                        $prido=$add[filename].$type;
                }
                else
                {
                        $prido=$add[filename].'_'.$pagepr.$type;
                }
                $prepage='<a class="s1" href="'.$dolink.$prido.'">'.$fun_r['pripage'].'</a>';
        }
        //下一页
        if($page!=$totalpage)
        {
                $pagenex=$page+1;
                $nextpage='<a class="s1" href="'.$dolink.$add[filename].'_'.$pagenex.$type.'">'.$fun_r['nextpage'].'</a>';
                $lastpage='<a class="s0" href="'.$dolink.$add[filename].'_'.$totalpage.$type.'">'.$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=s2>";
                        $is_2="</a>";
                }
                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.=$is_1.$i.$is_2;
        }
        $returnstr=$firststr.$toppage.$prepage.$returnstr.$nextpage.$lastpage;
        return $returnstr;