dede怎么集成搜索栏?
这篇文章主要介绍了DEDE集成百度搜索谷歌搜索站内全站搜索站内按栏目搜索等功能的搜索栏,可以让访客点选使用百度搜索站内内容或者用谷歌搜索站点内容,或者直接搜索整站内容,或者点选按栏目搜索站内内容,感兴趣的小伙伴们可以参考一下
推荐学习:织梦cms
DEDE可定制性非常强,我们接到一个项目,要求定制站点的搜索框,要求能有个选项,可以让访客点选使用百度搜索站内内容或者用谷歌搜索站点内容,或者直接搜索整站内容,或者点选按栏目搜索站内内容
全部代码如下:
<divclass="search-bg"><divclass="inner"><divclass="search-form"><formrole="search"method="get"id="searchform"name=bfonSubmit="bottomForm();returnfalse;"><script>functionbottomForm(){var$=document.bf.key.value;var$2=document.bf.sto.value;if(document.bf.sto[0].selected)window.open("https://www.baidu.com/s?wd="+"site%3Abnxb.com+"+$);if(document.bf.sto[1].selected)window.open("https://www.google.com.hk/search?hl=zh-CN&source=hp&q="+"site%3Awww.bnxb.com+"+$);if(document.bf.sto[2].selected)window.open("{dede:global.cfg_basehost/}/app/search.php?kwtype=1&keyword="+$);elsewindow.open("{dede:global.cfg_basehost/}/app/search.php?kwtype=1&keyword="+$+"&typeid="+$2);returnfalse}</script><inputname="key"id="s"class="s"value="请输入关键词开始搜索!"onClick="this.value='';"style="background-color:rgb(255,255,255);color:rgb(153,153,153);opacity:0.8664601413572597;background-position:initialinitial;background-repeat:initialinitial;"onKeyPress="javascript:if(event.keyCode==13){query(this.value);}"x-webkit-speech=""type="text"><SELECTclass="search-select"name="sto"id="search-option"><optionvalue="0"class="search-select-option">百度搜索</option><optionvalue="1111"class="search-select-option">谷歌搜索</option><optionvalue="2222"selected='1'class="search-select-option">全站搜索</option>{dede:channelartlisttypeid='top'}{dede:type}<optionvalue='[field:id/]'>[field:typename/]</option>{/dede:type}{dede:channeltype='son'noself='yes'}<optionvalue='[field:id/]'>--[field:typename/]</option>{/dede:channel}{/dede:channelartlist}</select><buttonid="searchsubmit"class="btn">搜索</button></form></div><divclass="tagscloud"><span>快捷搜索:</span> {dede:hotwordsnum='5'subday='30'maxlength='10'/}</div></div></div>