織夢默認的搜索功能,是只可以搜索全部欄目或者指定的搜索某一個欄目,而不能搜索指定的多個欄目,需要二次開發(fā)修改才能實現(xiàn),方法如下:
1、在搜索框表單里加個typeid提交過去
例如
<form name="formsearch" action="/plus/search.php">
<input type="hidden" name="typeid" value="1,2,3">
</form>
2、打開/plus/search.php找到
$typeid = (isset($typeid) && is_numeric($typeid)) ? $typeid : 0;
刪除這一行后,繼續(xù)找到
$typeid = intval($typeid);
也刪除這一行
3、打開 /include/arc.searchview.class.php 找到
$ksqls[] = " typeid IN (".GetSonIds($this->TypeID).") ";
改成
//指定了多個欄目時
if( preg_match('#,#', $this->TypeID) )
{
$typeids = explode(',', $this->TypeID);
foreach($typeids as $ttid) {
$typeidss[] = GetSonIds($ttid);
}
$typeidStr = join(',', $typeidss);
$typeidss = explode(',', $typeidStr);
$typeidssok = array_unique($typeidss);
$typeid = join(',', $typeidssok);
$ksqls[] = " arc.typeid IN ($typeid) ";
}
else
{
$ksqls[] = " arc.typeid IN (".GetSonIds($this->TypeID).") ";
}
舉例:
<form name="formsearch" action="/plus/search.php">
<input class="text" type="text" id="search-keyword" name="q" value="">
<input type="hidden" name="typeid" value="1,5">
<input class="btn" type="submit" value="0"/>
</form>
例子中就是指定ID1和5欄目的搜索范圍。
以上修改后臺文件后,在前調(diào)用就可以實現(xiàn)指定多個欄目范圍搜索了。
以上就是關(guān)于【織夢搜索頁指定多個欄目范圍搜索的方法】的文章內(nèi)容,如果您還想了解更多關(guān)于網(wǎng)站建設(shè)與網(wǎng)絡推廣的相關(guān)文章,請繼續(xù)查看【織夢教程】欄目的其它文章
來源www.dashustudio.net廣州明行威,致力于中小企業(yè)網(wǎng)絡營銷推廣、整體外包運營(網(wǎng)站建設(shè)、SEM、SEO等)、企業(yè)SEO內(nèi)訓、信息流廣告運營
歡迎交流 加微信13430336474 廣州張楷

上一篇:在文章或列表頁面中調(diào)用頂級欄目鏈接的方法 下一篇:織夢channelartlist指定欄目調(diào)用二級欄目和三級欄目實現(xiàn)方法