欢迎光临
我们一直在努力

织梦DEDECMS搜索结果页按频道模型显示不同模板

思路: 给搜索框加一个判定,例如搜索软件模型的时候显示一个模板,搜索文章模型的时候显示一个模板。

1.在head区域加入

<script language=”javascript” type=”text/javascript”> 
<!– 
 function check(){ 
  if(document.formsearch.channeltype.value==”3″) 
  document.formsearch.action=”{dede:field name=’phpurl’/}/search_images.php” 
  else 
  document.formsearch.action=”{dede:field name=’phpurl’/}/search.php” 
 } 
–> 
</script> 

2.更改搜索代码

<form  name=”formsearch” action=”” *****ubmit=”check();”> 
        <div class=”form”> 
           <input type=”hidden” name=”kwtype” value=”0″ /> 
           <input name=”q” type=”text” class=”search-keyword” id=”search-keyword”

 value=”{dede:global name=’keyword’ function=’RemoveXSS(@me)’/}” /> 
       <select name=”channeltype” id=”channeltype” > 
    <option value=’1′ selected=’1′>新闻</option> 
        <option value=’3′>软件</option> 
           </select> 
          <button type=”submit” class=”search-submit”>搜索</button> 
        </div> 
   </form> 

赞(0) 打赏
未经允许不得转载:王子主页 » 织梦DEDECMS搜索结果页按频道模型显示不同模板

觉得文章有用就打赏一下文章作者

非常感谢你的打赏,我们将继续提供更多优质内容,让我们一起创建更加美好的网络世界!

支付宝扫一扫

微信扫一扫

登录

找回密码