一、打开/e/search/index.php 411行左右,找到:
Header("Location:result/?searchid=$searchid".$dogetvar);
修改为:
Header("Location:$public_r[newsurl]search-0-$searchid.html".$dogetvar);
二、打开/e/search/result/index.php20行左右,找到:
//搜索结果$searchid=(int)$_GET['searchid'];
在//搜索结果上一行添加函数:
//增加分页函数function page10($num,$line,$page_line,$start,$page,$search){global $fun_r;if($num<=$line){return '';}$search=RepPostStr($search,1);$url=$public_r['newsurl'].'search';$snum=2;//最小页数$totalpage=ceil($num/$line);//取得总页数$firststr='<a title="'.$fun_r['trecord'].'"> '.$num.' </a> ';//上一页if($page<>0){$toppage='<a href="'.$url.'-0-'.$search.'.html">'.$fun_r['startpage'].'</a> ';$pagepr=$page-1;$prepage='<a href="'.$url.'-'.$pagepr.'-'.$search.'.html">'.$fun_r['pripage'].'</a>';}//下一页if($page!=$totalpage-1){$pagenex=$page 1;$nextpage=' <a href="'.$url.'-'.$pagenex.'-'.$search.'.html">'.$fun_r['nextpage'].'</a>';$lastpage=' <a href="'.$url.'-'.($totalpage-1).'-'.$search.'.html">'.$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="<b>";$is_2="</b>";}else{$is_1='<a href="'.$url.'-'.$i.'-'.$search.'.html">';$is_2="</a>";}$pagenum=$i 1;$returnstr.=" ".$is_1.$pagenum.$is_2;}$returnstr=$firststr.$toppage.$prepage.$returnstr.$nextpage.$lastpage;return $returnstr;}
然后在48行左右找到:
$listpage=page1($num,$line,$page_line,$start,$page,$search);
修改为
$listpage=page10($num,$line,$page_line,$start,$page,$search);
修改:
$search="&searchid=".$searchid;
为
$search="$searchid";
三、添加伪静态规则(例子为Apache,自己修改为对应的)
#搜索RewriteRule ^search-(. ?)-(. ?)/.html$ /e/search/result/index/.php/?page=$1&searchid=$2
四、修改搜索模板中的提交地址为绝对地址:
比如
<form action='/e/search/index.php' method="post" name="search_news" id="search_news">
提示:不建议使用相对地址。
效果图: