首页 > 其他 > 详细

帝国cms7.0修改默认搜索模版中的分页[!--show.page--]

时间:2014-02-05 16:15:16      阅读:659      评论:0      收藏:0      [点我收藏+]

修改默认搜索模版的分页是在e/class/connect.php下

搜索下function page1就是我们要修改的分页了

下面贴上我修改后的分页

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
//前台分页
function page1($num,$line,$page_line,$start,$page,$search){
    global $fun_r;
    if($num<=$line)
    {
        return ‘‘;
    }
    $search=RepPostStr($search,1);
    $url=eReturnSelfPage(0).‘?page‘;
    $snum=2;//最小页数
    $totalpage=ceil($num/$line);//取得总页数
    $firststr=‘<a title="‘.$fun_r[‘trecord‘].‘" class="disabled">‘.$num.‘</a>‘;
    //上一页
    if($page<>0)
    {
        $toppage=‘<a href="‘.$url.‘=0‘.$search.‘" class="disabled">‘.$fun_r[‘startpage‘].‘</a>‘;
        $pagepr=$page-1;
        $prepage=‘<a href="‘.$url.‘=‘.$pagepr.$search.‘" class="disabled">‘.$fun_r[‘pripage‘].‘</a>‘;
    }
    //下一页
    if($page!=$totalpage-1)
    {
        $pagenex=$page+1;
        $nextpage=‘<a href="‘.$url.‘=‘.$pagenex.$search.‘" class="disabled">‘.$fun_r[‘nextpage‘].‘</a>‘;
        $lastpage=‘<a href="‘.$url.‘=‘.($totalpage-1).$search.‘" class="disabled">‘.$fun_r[‘lastpage‘].‘</a>‘;
    }
    $starti=$page-$snum<0?0:$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>";
        }
        else
        {
            $is_1=‘<a href="‘.$url.‘=‘.$i.$search.‘">‘;
            $is_2="</a>";
        }
        $pagenum=$i+1;
        $returnstr.=$is_1.$pagenum.$is_2;
    }
    $returnstr=$firststr.$toppage.$prepage.$returnstr.$nextpage.$lastpage;
    return $returnstr;
}

 

上面的代码样式和我在上篇(帝国cms 列表页分页样式修改美化【2】)中的一样,有需要的可以看看

最后一点要说明下,就是分页个数是在【系统设置】-【系统参数设置】-【搜索设置】-【页面设置】中根据自己的需要设置把

帝国cms7.0修改默认搜索模版中的分页[!--show.page--]

原文:http://www.cnblogs.com/huige728/p/3538208.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!