不用修改底層,直接用sql語句在模板里面修改就可以。這個(gè)可以在標(biāo)題和內(nèi)容中聯(lián)合搜索,還可以排除指定欄目,上代碼:
<ul class="normal-list text-left">
{eyou:assign name="keywords" value="$eyou.field.keywords"}
{eyou:sql sql="select aid from ey_article_content where content like '%$keywords%'unionselect aid from ey_archives where title like '%$keywords%'" empty='沒有找到想要的結(jié)果'}
{eyou:assign name="aid" value="$field.aid"}
{eyou:sql sql="select aid from ey_archives where aid='$aid' && typeid!='11'" id="field3"}
<li class="dot">
{eyou:arcview aid="$field3.aid" id="field2" addfields="content"}
<a href="{$field2.arcurl}" title="{$field2.title}"><h1>{$keywords,"<font color='red'>$keywords</font>",$field2.title|str_replace}</h1></a>
{eyou:assign name="neirong" value="$field2.content|html_msubstr=###,0,200"}
<div>{$keywords,"<font color='red'>$keywords</font>",$neirong|str_replace}</div>
<span>{$field2.add_time|MyDate='Y-m-d',###}</span>
</li>
{/eyou:arcview}
{/eyou:sql}
{/eyou:sql}
</ul>
其中typeid為想要排除的欄目id