搜索框代码里使用name="q"作为搜索框属性,例如
0T9534J7-0
打开/include/taglib/arclist.lib.php文件
找到
$innertext = trim($innertext);
在它下面加入
preg_match("/~([A-Za-z0-9_]+)~/s", $keyword, $conditions); if(isset($_REQUEST['q']) && $keyword = '~q~') { preg_match("/~([A-Za-z0-9_]+)~/s", $keyword, $conditions); $keyword = addslashes(trim($_REQUEST['q'])); }
继续找到
$taghash = md5(serialize($ctag).$typeid);
改成
$taghash = md5(serialize($ctag).$typeid.$keyword);
模板 search.htm里调用代码
{dede:channelartlist row=5 typeid=top}
<h2>{dede:field.typename/}</h2>
<div>
<ul>
{dede:arclist row='20' titlelen='250' keyword='~q~'}
<li>
<a href="[field:arcurl/]" target="_blank">[field:title/]</a>
</li>
{/dede:arclist}
</ul>
</div>
{/dede:channelartlist}