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}


文档最后更新时间:2023-04-19 08:44:17

文档
目录

深色
模式

切换
宽度