织梦模板怎么添加搜索框

织梦模板怎么添加搜索框,第1张

添加搜索框代码如下:

<form method="post"

action="{dede:global.cfg_basehost/}/plus/search.php" name="formsearch"

class="search"><input type="hidden" value="www.dedecms.com" name="domains"><input type="hidden" value="0" name="kwtype">

                    <table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">

                              <tr>

                                <td width="65"></td>

                                <td width="146" valign="middle"><input class="keywords"   name="q" type="text" id="search"  value="请输入搜索内容...">

                                <input type="hidden" value="titlekeyword" name="searchtype" >

                                </td>

                                <td width="5"></td>

                                <td><button type="submit" class="submit"></button></td>

                              </tr>

                        </table>

                      </form>

二、

<form method="post" action="{dede:global.cfg_basehost/}/plus/search.php" name="formsearch" class="search"><input type="hidden" value="www.dedecms.com" name="domains"><input type="hidden" value="0" name="kwtype"> 

<table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0">

<tr>

<td width="65">&nbsp</td>

<td width="146" valign="middle">

<input class="keywords"   name="q" type="text" id="search"  value="请输入搜索内容..." onFocus="if(this.value=='请输入搜索内容...'){this.value=''}" onBlur="if(this.value==''){this.value='请输入搜索内容...'}">

<input type="hidden" value="titlekeyword" name="searchtype" >

</td>

<td width="5">&nbsp</td>

<td> <button type="submit" class="submit"></button> </td>

</tr>

</table>

</form>

1、首先要做好搜索结果页面,写好css样式

2、然后在需要搜索的模板页面写入栏目搜索标签

3、按照下面这个分类搜索的标签作为参考,修改你的css样式,注意提交的name值要和你织梦search.php字段一致。

<form action="{dede:field name='phpurl'/}/search.php">

          <select name="typeid" class="search-option" id="typeid">

            <option value='0' selected='1'>全部栏目</option>

 {dede:channelartlist typeid='top' } 

 {dede:type} 

            <option value='[field:id/]'>--[field:typename/]</option>

            {/dede:type} 

 {dede:channel type='son' noself='yes'}

            <option value='[field:id/]'>-[field:typename/]</option>

            {/dede:channel} 

 {/dede:channelartlist}

          </select>

          <input type="hidden" name="kwtype" value="0" />

          <input type="hidden" name="searchtype" value="titlekeyword" />

          <input name="keyword" type="text" class="search-keyword" id="search-keyword" />

          <button type="submit" class="search-submit"> </button>

        </form>


欢迎分享,转载请注明来源:内存溢出

原文地址:https://www.54852.com/bake/11860935.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2023-05-19
下一篇2023-05-19

发表评论

登录后才能评论

评论列表(0条)

    保存