Header("Location:result/?searchid=$searchid".$dogetvar);
修改成:
Header("Location:$public_r[newsurl]search-0-$searchid.html".$dogetvar);
二、打开esearchresultindex.php 20行左右,找到:
//搜索结果
$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";
三、添加伪静态规则(nginx)
rewrite ^/search-(.+?)-(.+?).html$ /e/search/result/index.php?page=$1&searchid=$2 last;
四、修改搜索模板中的提交地址为绝对地址:
<script type="text/javascript">
function checkSubmit()
{
var input = document.forms["form1"].elements["q"];
var q = input.value.trim();
if (q == '')
{
alert("请输入要查询的内容!");
input.focus();
return false;
}
}
</script>
<form name=search_js1 method=post action='[!--news.url--]e/search/index.php' onsubmit='return search_check(document.search_js1);' target="_blank">
<p align=center>
<select name=show style="display:none">
<option value=title>标题</option>
<option value=title>搜索全部</option>
</select>
<select name=classid style="display:none">
<option value=0>所有栏目</option>[!--class--]</select>
<input name=keyboard type=text size=45 class="textbox">
<input type=submit name=Submit value=查询 class="button">
</p>
<div class="search-tips">请输入要查询的食物名称</div>
</form>