织梦在搜索结果页按栏目分块显示数据(无分页)

1、搜索框代码里使用name="q"作为搜索框属性,例如

织梦在搜索结果页按栏目分块显示数据(无分页)

2、打开 /include/taglib/arclist.lib.php 找到,大概在188行

$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);

3、搜索结果模板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}

完成

注明:本文为星速云原创版权所有,禁止转载,一经发现将追究版权责任!

(0)
上一篇 2022年7月14日 下午5:35
下一篇 2022年7月14日 下午5:35

相关推荐

发表评论

登录后才能评论
问答社区 QQ客服
微信客服
微信客服
分享本页
返回顶部