searchform 搜索標簽

【基礎用法】
標簽:searchform
描述:文檔標題搜索,默認搜索整站
用法:
{eyou:searchform type=’sonself’}
<form method=”get” action=”{$field.action}”>
<input type=”text” name=”keywords” />
<input type=”submit” value=’點擊搜索’ />
{$field.hidden}
</form>
{/eyou:searchform}
屬性:
type=’default’ 默認搜索方式,如果指定typeid屬性,想實現連同子分類一起搜索,可以設置 type=’sonself’
typeid=” 默認搜索所有欄目的文檔標題,可以指定欄目id搜索,也可以在不同欄目搜索當前欄目的文檔,比如:typeid=’$eyou.field.typeid’
modelid=” 默認搜索所有模型的文檔標題,可以指定模型id搜索,也可以在不同欄目所在模型搜索當前模型的文檔,比如:modelid=’$eyou.field.current_channel’

模板自定義:

搜索列表默認模板是?lists_search.htm,要實現不同模型展示模板不同,可以加上模型標識,格式:lists_search_模型ID.htm

比如:文章模型?lists_search_1.htm

產品模型?lists_search_2.htm

圖集模型?lists_search_3.htm

下載模型?lists_search_4.htm

視頻模型?lists_search_5.htm

專題模型?lists_search_7.htm

……

涉及表字段:

 

【更多示例】
——————————-示例1——————————–
描述:整站搜索
{eyou:searchform type=’sonself’}
? ? <form class=”sidebar-search” method=”get” action=”{$field.action}”>
? ? ? ? <input type=”text” class=”form-control” name=”keywords” placeholder=”請輸入關鍵詞” />
? ? ? ? <input type=”submit” name=”btn” value=”搜索” />
{$field.hidden}
? ? </form>
{/eyou:searchform}

——————————-示例2——————————–
描述:指定產品模型搜索
{eyou:searchform type=’sonself’ modelid=’2′}
? ? <form class=”sidebar-search” method=”get” action=”{$field.action}”>
? ? ? ? <input type=”text” class=”form-control” name=”keywords” placeholder=”請輸入關鍵詞” />
? ? ? ? <input type=”submit” name=”btn” value=”搜索” />
{$field.hidden}
? ? </form>
{/eyou:searchform}

——————————-示例3——————————–
描述:指定欄目搜索
{eyou:searchform type=’sonself’ typeid=’2′}
? ? <form class=”sidebar-search” method=”get” action=”{$field.action}”>
? ? ? ? <input type=”text” class=”form-control” name=”keywords” placeholder=”請輸入關鍵詞” />
? ? ? ? <input type=”submit” name=”btn” value=”搜索” />
{$field.hidden}
? ? </form>
{/eyou:searchform}