Warning: Illegal string offset 'top' in /www/wwwroot/hellyhua.com/wp-content/themes/Snape/single.php on line 45

我们在用织梦dede实现搜索时会遇到搜索结果页面要指向不同的页面,比如说dedecms中英文的搜索实现,需要在不同语言下搜索显示不同的语言,那就必须做两个搜索页模版才行;还有就是按频道模型,不同的频道栏目指向不同的搜索页面。那么,如何实现织梦搜索结果页指向不同的模板页面呢?今天青岛做网站就跟大家分享一下自己的解决办法。

   笔者发现dedecms5.7版本的搜索页模版 已经不是在plus/search.php那里指定,而是转移到include/arc.searchview.class.php这个文件,以下是两种方法跟大家分享一下:

方法一:

1、打开include/arc.searchview.class.php文件,找到

$tempfile=$GLOBALS[’cfg_basedir’].$GLOBALS[’cfg_templets_dir’]."/".$GLOBALS[’cfg_df_style’]."/search.htm";

2、把search.htm修改成你需要的模版名字即可,当然你需要在templates/你的默认模版目录里面有这个新模版文件才行。

3、如果想在不同界面搜索时使用不同的模版,可以制作多一个search_en.htm模版,再在include/arc.searchview.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.htm";

if($typeyy="en")

{

$tempfile = $GLOBALS[’cfg_basedir’].$GLOBALS[’cfg_templets_dir’]."/".$GLOBALS[’cfg_df_style’]."/search_en.htm";

}

4、然后在列表页或文章页模版里面你需要提交搜索的那部分之间增加一个参数typeyy,属性为hidden值为en

方法二:

1、复制serach.php 更名为 search_images.php

2、打开 search_images.php

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

更改为

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

3、复制 arc.searchview.class.php 更名为 arc.searchimg.class.php

4、打开 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";


Warning: Illegal string offset 'footer' in /www/wwwroot/hellyhua.com/wp-content/themes/Snape/single.php on line 49