首页 > 网站 > 建站经验 > 正文

DEDECMS修改默认搜索为百度站内搜索方法详解

2024-04-25 20:51:51
字体:
来源:转载
供稿:网友
织梦DEDECMS的搜索功能一直有很多的不足之处,而如今百度站内搜索已全面开放。相比DEDECMS的搜索功能,百度站内搜索更具优势!下面,vevb就教大家如何将织梦默认搜索改为百度站内搜索,此教程基于DEDECMS默认模板制作,其他模板请自行根据教程修改,方法大体类似。


打开:templets/default/目录下的head2.htm和head.htm,找到其中的:


      <form  name="formsearch" action="{dede:global.cfg_cmsurl/}/plus/search.php">
        <div class="form">
          <h4>搜索</h4>
           <input type="hidden" name="kwtype" value="0" />
           <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="searchtype" class="search-option" id="search-option">
               <option value="title" selected='1'>检索标题</option>
               <option value="titlekeyword">智能模糊</option>
           </select>
          <button type="submit" class="search-submit">搜索</button>
        </div>
        </form>


修改为:



      <form  name="formsearch" action="http://so.vevb.com/cse/search">
        <div class="form">
          <h4>搜索</h4>
            <input type="hidden" name="s" value="3527383009548599228">
             <input type="hidden" name="ie" value="gbk">

           <input name="q" type="text" class="search-keyword" id="search-keyword" value="在这里搜索..." onfocus="if(this.value=='在这里搜索...'){this.value='';}"  onblur="if(this.value==''){this.value='在这里搜索...';}" />
          <button type="submit" class="search-submit">搜索</button>
        </div>
        </form>


其中,红色部分为新增。 <input type="hidden" name="s" value="3527383009548599228">   value值为搜索引擎ID,登陆百度站内搜索中可查看。
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表