在/plus/search.php 找到
$typeid = (isset($typeid) && is_numeric($typeid)) ? $typeid : 0;
注释或者删除它 改成
$typeid = intval($typeid);
打开 \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="{dede:global.cfg_cmsurl/}/plus/search.php">
<div class="form">
<input type="hidden" name="searchtype" value="title">
<input name="q" type="text" class="search-keyword" id="search-keyword" value="在这里搜索..." onfocus="if(this.value=='在这里搜索...'){this.value='';}"
onblur="if(this.value==''){this.value='在这里搜索...';}" />
<select name='typeid' style='width:200'>
<option value='1,2' selected>asfasdf</option>
<option value='85,3'>─2018</option>
<option value='70,86'>─2017</option>
<option value='117'>─2016</option>
</select>
<button type="submit" class="search-submit">搜索</button>
</div>
</form>
如果觉得我的文章对您有用,请随意打赏。你的支持将鼓励我继续创作!