• 织梦dedecms设置不同的搜索页模板教程


    1.在head区域加入如下代码:
    <script language="javascript" type="text/javascript">
    function check(){
    if(document.formsearch.channeltype.value=="1")
    document.formsearch.action="{dede:field name='phpurl'/}/search.php"
    else
    document.formsearch.action="{dede:field name='phpurl'/}/search_news.php"}
    </script>
        这段代码主要用来判断你选择了什么频道,根据你选择的频道的不同,来使用不同的搜索页模板。
     
    2.更改搜索代码
    <form name="formsearch" action="" data-ke-onsubmit="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>
     
    其中重点就是
     
    <select name="channeltype" id="channeltype" >
    <option value='1' selected='1'>新闻</option>
    <option value='3'>软件</option>
    </select>
     
    关键设置:这里设置的按模型搜索  1是文章模型 3是软件模型
     
    3.复制/plus/serach.php 更名为 /plus/search_images.php
     
    4.打开 search_images.php将如下代码:
    require_once(DEDEINC."/arc.searchview.class.php");
    更改为
    require_once(DEDEINC."/arc.searchimg.class.php");
     
    5.复制 /include/arc.searchview.class.php 更名为 /include/arc.searchimg.class.php
     
    6.打开 arc.searchimg.class.php查找如下代码:
    $tempfile = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir']."/".$GLOBALS['cfg_df_style']."/search.htm";
     
    更改为
    $tempfile = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir']."/".$GLOBALS['cfg_df_style']."/search_images.htm
     
    做完上面的操作,基本就可以调用出不同的搜索页模板了。
  • 相关阅读:
    TLS1.3&TLS1.2形式化分析(二)
    浏览器代理设置和取消代理
    jdk在window系统中的配置
    pycharm2017.3版本永久激活
    Scyther 形式化分析工具资料整理(三)
    百度快照的检索和反馈删除
    Scyther-Semantics and verification of Security Protocol 翻译 (第二章 2.2.2----2.3)
    双一流学校名单
    Scyther tools 协议形式化分析帮助文档翻译
    全国书画艺术之乡-----通渭
  • 原文地址:https://www.cnblogs.com/zqw111/p/12456912.html
Copyright © 2020-2023  润新知