织梦--搜索页

这篇博客详细介绍了如何在织梦系统中配置和使用搜索页,包括修改跳转页面、使用channelartlist和arclist标签、搜索指定栏目、搜索页码设置,以及实现中英文站的独立搜索。通过修改相关PHP文件和模板,可以实现更灵活的搜索功能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

跳转页面需要修改

搜索的form添加属性

<form action="/plus/search.php" name="formsearch" method="get" target="_blank"> 
    <input type="hidden" name="keytype" value="0" /> 
    <input type="text" class="shuru" placeholder="信息搜索" name="q"> 
    <input type="image" class="ss_anniu" src="/skin/img/ss1.png"> 
</form>

1.form整行 2.隐藏input 3.输入框name="q"

 

正常使用织梦标签(channelartlist,arclist)

打开include/arc.searchview.class.PHP

  查找:

require_once(DEDEINC."/taglib/hotwords.lib.php");

require_once(DEDEINC."/taglib/channel.lib.php");

  在下面加入:

require_once(DEDEINC."/taglib/arclist.lib.php");   

require_once(DEDEINC."/taglib/channelartlist.lib.php");

  找到:

else if($tagname=="hotwords")               

{                   

$this->dtp->Assign($tagid,lib_hotwords($ctag,$this));

}

  在下面插入:

else if($tagname=="arclist")

{                   

$this->dtp->Assign($tagid,lib_arclist($ctag,$this)); 

}               

else if($tagname=="channelartlist")  

{                   

$this->dtp->Assign($tagid,lib_channelartlist($ctag,$this)); 

}

  这样就可在dedecms织梦搜索页面使用arclist和channelartlist标签调用数据了。 

 

搜索指定栏目

在模板搜索代码中加入 “<input type='hidden' name='typeid' value="栏目ID号">” 即可

搜索指定多个栏目(好像不用二开直接用就行)

http://www.dede58.com/a/dedejq/8429.html

搜索页页码

打开include/arc.searchview.class.php

修改GetPageListDM方法的内容

中英文分别搜索

在使用织梦dedecms制作中英文站时,需要在中文站中只搜索出中文站的内容,而在英文站中只搜索出英文站的内容,此时就需要给英文站搜索栏目单独做个模板出来,可以按以下方法来实现.

 

1.复制 plus 目录下的 serach.php 文件,并更名为 search_en.php 做为新的搜索文件.

打开搜索

require_once(DEDEINC."/arc.searchview.class.php");

替换为

require_once(DEDEINC."/arc.searchview_en.class.php");

2.复制 include 目录下的 arc.searchview.class.php 文件,并更名为 arc.searchview_en.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_en.htm";

3.复制模板中的 search.htm ,并更名为 search_en.htm ,此时英文站的模板都已做好,找到英文站的相关搜索代码,如下以示例:

<form action="/plus/search_en.php" method="post"></p> <p><input type="hidden" name="typeid" value="6" />

其中的 /plus/search_en.php ,用 search_en.php 去搜索,name="typeid" value="6" 这个是指定栏目ID.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值