dede5.7搜索页分页样式修改

  1. 需要修改的文件,include目录下的

    arc.searchview.class.php

  2. 查找

    获取动态的分页列表

    大约在805行

    修改代码下面代码

     

    /**

    *  获取动态的分页列表

    *

    * @access    public

    * @param     string  $list_len  列表宽度

    * @return    string

    */

    function GetPageListDM($list_len)

    {

    global $oldkeyword;

    $prepage="";

    $nextpage="";

    $prepagenum = $this->PageNo - 1;

    $nextpagenum = $this->PageNo + 1;

    if($list_len=="" || preg_match("/[^0-9]/", $list_len))

    {

    $list_len=3;

    }

    $totalpage = ceil($this->TotalResult / $this->PageSize);

    if($totalpage<=1 && $this->TotalResult>0)

    {

    return "共1页/".$this->TotalResult."条记录";

    }

    if($this->TotalResult == 0)

    {

    return "共0页/".$this->TotalResult."条记录";

    }

    $purl = $this->GetCurUrl();

    $oldkeyword = (empty($oldkeyword) ? $this->Keyword : $oldkeyword);

    //当结果超过限制时,重设结果页数

    if($this->TotalResult > $this->SearchMaxRc)

    {

    $totalpage = ceil($this->SearchMaxRc/$this->PageSize);

    }

    $infos = "<td>共找到<b>".$this->TotalResult."</b>条记录/最大显示<b>{$totalpage}</b>页 </td>\r\n";

    $geturl = "keyword=".urlencode($oldkeyword)."&searchtype=".$this->SearchType;

    $hidenform = "<input type='hidden' name='keyword' value='".rawurldecode($oldkeyword)."'>\r\n";

    $geturl .= "&channeltype=".$this->ChannelType."&orderby=".$this->OrderBy;

    $hidenform .= "<input type='hidden' name='channeltype' value='".$this->ChannelType."'>\r\n";

    $hidenform .= "<input type='hidden' name='orderby' value='".$this->OrderBy."'>\r\n";

    $geturl .= "&kwtype=".$this->KType."&pagesize=".$this->PageSize;

    $hidenform .= "<input type='hidden' name='kwtype' value='".$this->KType."'>\r\n";

    $hidenform .= "<input type='hidden' name='pagesize' value='".$this->PageSize."'>\r\n";

    $geturl .= "&typeid=".$this->TypeID."&TotalResult=".$this->TotalResult."&";

    $hidenform .= "<input type='hidden' name='typeid' value='".$this->TypeID."'>\r\n";

    $hidenform .= "<input type='hidden' name='TotalResult' value='".$this->TotalResult."'>\r\n";

    $purl .= "?".$geturl;

    //获得上一页和下一页的链接

    if($this->PageNo != 1)

    {

    $prepage.="<td width='50'><a href='".$purl."PageNo=$prepagenum'>上一页</a></td>\r\n";

    $indexpage="<td width='30'><a href='".$purl."PageNo=1'>首页</a></td>\r\n";

    }

    else

    {

    $indexpage="<td width='30'>首页</td>\r\n";

    }

    if($this->PageNo!=$totalpage && $totalpage>1)

    {

    $nextpage.="<td width='50'><a href='".$purl."PageNo=$nextpagenum'>下一页</a></td>\r\n";

    $endpage="<td width='30'><a href='".$purl."PageNo=$totalpage'>末页</a></td>\r\n";

    }

    else

    {

    $endpage="<td width='30'>末页</td>\r\n";

    }

    //获得数字链接

    $listdd="";

    $total_list = $list_len * 2 + 1;

    if($this->PageNo >= $total_list)

    {

    $j = $this->PageNo - $list_len;

    $total_list = $this->PageNo + $list_len;

    if($total_list > $totalpage)

    {

    $total_list = $totalpage;

    }

    }

    else

    {

    $j=1;

    if($total_list > $totalpage)

    {

    $total_list = $totalpage;

    }

    }

    for($j; $j<=$total_list; $j++)

    {

    if($j == $this->PageNo)

    {

    $listdd.= "<td>$j&nbsp;</td>\r\n";

    }

    else

    {

    $listdd.="<td><a href='".$purl."PageNo=$j'>[".$j."]</a>&nbsp;</td>\r\n";

    }

    }

    $plist  =  "<table border='0' cellpadding='0' cellspacing='0'>\r\n";

    $plist .= "<tr align='center' style='font-size:10pt'>\r\n";

    $plist .= "<form name='pagelist' action='".$this->GetCurUrl()."'>$hidenform";

    $plist .= $infos;

    $plist .= $indexpage;

    $plist .= $prepage;

    $plist .= $listdd;

    $plist .= $nextpage;

    $plist .= $endpage;

    if($totalpage>$total_list)

    {

    $plist.="<td width='38'><input type='text' name='PageNo' style='width:28px;height:14px' value='".$this->PageNo."' /></td>\r\n";

    $plist.="<td width='30'><input type='submit' name='plistgo' value='GO' style='width:30px;height:22px;font-size:9pt' /></td>\r\n";

    }

    $plist .= "</form>\r\n</tr>\r\n</table>\r\n";

    return $plist;

    }

    修改为下面代码即可

    /**

    *  获取动态的分页列表

    *

    * @access    public

    * @param     string  $list_len  列表宽度

    * @return    string

    */

    function GetPageListDM($list_len)

    {

    global $oldkeyword;

    $prepage="";

    $nextpage="";

    $prepagenum = $this->PageNo - 1;

    $nextpagenum = $this->PageNo + 1;

    if($list_len=="" || preg_match("/[^0-9]/", $list_len))

    {

    $list_len=3;

    }

    $totalpage = ceil($this->TotalResult / $this->PageSize);

    if($totalpage<=1 && $this->TotalResult>0)

    {

    return "共1页/".$this->TotalResult."条记录";

    }

    if($this->TotalResult == 0)

    {

    return "共0页/".$this->TotalResult."条记录";

    }

    $purl = $this->GetCurUrl();

    $oldkeyword = (empty($oldkeyword) ? $this->Keyword : $oldkeyword);

    //当结果超过限制时,重设结果页数

    if($this->TotalResult > $this->SearchMaxRc)

    {

    $totalpage = ceil($this->SearchMaxRc/$this->PageSize);

    }

    //$infos = "<td>共找到<b>".$this->TotalResult."</b>条记录/最大显示<b>{$totalpage}</b>页 </td>\r\n";

    $infos = "共找到<b>".$this->TotalResult."</b>条记录/最大显示<b>{$totalpage}</b>页\r\n";

    $geturl = "keyword=".urlencode($oldkeyword)."&searchtype=".$this->SearchType;

    $hidenform = "<input type='hidden' name='keyword' value='".rawurldecode($oldkeyword)."'>\r\n";

    $geturl .= "&channeltype=".$this->ChannelType."&orderby=".$this->OrderBy;

    $hidenform .= "<input type='hidden' name='channeltype' value='".$this->ChannelType."'>\r\n";

    $hidenform .= "<input type='hidden' name='orderby' value='".$this->OrderBy."'>\r\n";

    $geturl .= "&kwtype=".$this->KType."&pagesize=".$this->PageSize;

    $hidenform .= "<input type='hidden' name='kwtype' value='".$this->KType."'>\r\n";

    $hidenform .= "<input type='hidden' name='pagesize' value='".$this->PageSize."'>\r\n";

    $geturl .= "&typeid=".$this->TypeID."&TotalResult=".$this->TotalResult."&";

    $hidenform .= "<input type='hidden' name='typeid' value='".$this->TypeID."'>\r\n";

    $hidenform .= "<input type='hidden' name='TotalResult' value='".$this->TotalResult."'>\r\n";

    $purl .= "?".$geturl;

    //获得上一页和下一页的链接

    if($this->PageNo != 1)

    {

    //$prepage.="<td width='50'><a href='".$purl."PageNo=$prepagenum'>上一页</a></td>\r\n";

    //$indexpage="<td width='30'><a href='".$purl."PageNo=1'>首页</a></td>\r\n";

    $prepage.="<a href='".$purl."PageNo=$prepagenum'>上一页</a>\r\n";

    $indexpage="<a href='".$purl."PageNo=1'>首页</a>\r\n";

    }

    else

    {

    //$indexpage="<td width='30'>首页</td>\r\n";

    $indexpage="<a>首页</a>\r\n";

    }

    if($this->PageNo!=$totalpage && $totalpage>1)

    {

    //$nextpage.="<td width='50'><a href='".$purl."PageNo=$nextpagenum'>下一页</a></td>\r\n";

    //$endpage="<td width='30'><a href='".$purl."PageNo=$totalpage'>末页</a></td>\r\n";

    $nextpage.="<a href='".$purl."PageNo=$nextpagenum'>下一页</a>\r\n";

    $endpage="<a href='".$purl."PageNo=$totalpage'>末页</a>\r\n";

    }

    else

    {

    //$endpage="<td width='30'>末页</td>\r\n";

    $endpage="<a>末页</a\r\n";

    }

    //获得数字链接

    $listdd="";

    $total_list = $list_len * 2 + 1;

    if($this->PageNo >= $total_list)

    {

    $j = $this->PageNo - $list_len;

    $total_list = $this->PageNo + $list_len;

    if($total_list > $totalpage)

    {

    $total_list = $totalpage;

    }

    }

    else

    {

    $j=1;

    if($total_list > $totalpage)

    {

    $total_list = $totalpage;

    }

    }

    for($j; $j<=$total_list; $j++)

    {

    if($j == $this->PageNo)

    {

    //$listdd.= "<td>$j&nbsp;</td>\r\n";

    $listdd.= "<a class='thisclass'>$j</a>\r\n";

    }

    else

    {

    //$listdd.="<td><a href='".$purl."PageNo=$j'>[".$j."]</a>&nbsp;</td>\r\n";[搜索页分页样式]

    $listdd.="<a href='".$purl."PageNo=$j'>".$j."</a>\r\n";

    }

    }

    $plist  =  "<table border='0' cellpadding='0' cellspacing='0'>\r\n";

    $plist .= "<tr align='center' style='font-size:10pt'>\r\n";

    $plist .= "<form name='pagelist' action='".$this->GetCurUrl()."'>$hidenform";

    $plist .= $infos;

    $plist .= $indexpage;

    $plist .= $prepage;

    $plist .= $listdd;

    $plist .= $nextpage;

    $plist .= $endpage;

    if($totalpage>$total_list)

    {

    $plist.="<td width='38'><input type='text' name='PageNo' style='width:28px;height:14px' value='".$this->PageNo."' /></td>\r\n";

    $plist.="<td width='30'><input type='submit' name='plistgo' value='GO' style='width:30px;height:22px;font-size:9pt' /></td>\r\n";

    }

    $plist .= "</form>\r\n</tr>\r\n</table>\r\n";

    return $plist;

    }

     

  3.  经过上面步骤。我们可以看到,仅仅是注释了函数中原来的代码,并没有删除,方便后续的查看,但是效果和删除一样的。

    在模板search.htm里面调用方式如下:

    <div id="pageNum">

    {dede:pagelist listsize='4'/}

    </div>

    他的CSS里面可以如下写,当然你也可以自己写,以下内容仅供参考。最终效果请看截图

    #pageNum {

    font-size: 14px;

    padding: 25px 0;

    text-align: center

    }

    #pageNum a {

    text-decoration: none;

    padding: 8px 9px;

    border: 1px solid #ccc;

    background: #fff;

    color: #333;

    -webkit-transition: all linear .2s;

    -moz-transition: all linear .2s;

    -ms-transition: all linear .2s;

    transition: all linear .2s;

    margin-right:5px;

    }

    #pageNum a:hover,#pageNum a.thisclass {

    background: #1592E5;

    color: #fff;

    border: 1px solid #1592E5

    }

下载说明: 帮助教程
1.资源失效请联系QQ:1138166071补发;寻课加QQ联系
2.资源均为网络收集,仅供参考研究,请在下载后24小时内删除。不要商用和非法用途,否则后果自己承担。
3.默认解压密码:blog.qdql.net
4.购买本站资源即代表同意本站免责协议
5.提示:本站资源属虚拟商品,购买后恕不退款。
6.特别声明本站资源部分来源于网络,如有侵权,请联系站长进行删除处理!
本文地址:http://blog.qdql.net/3766/

发表评论


表情