织梦园模板网提供云优cms模板,pbootcms模板,Wordpress主题模板等各类企业新闻资讯网站模板下载服务。织梦园网站模板交流群
用户名:
密码:
注册
注册后享受折扣价

织梦手机站搜索与PC同步的方法

织梦园模板 / 2020-07-24 / 收藏

之前介绍过织梦手机站搜索与PC站搜索结果一样的解决方法,后来测试发现此方法仅支持织梦默认移动程序。

下面介绍织梦手机站搜索与PC同步的方法:

1、找到/plus/search.php文件,复制一份重命名为search_m.php,这里随意命名都行。

2、找到/include/arc.searchview.class.php文件,复制一份重命名为arc.searchview.class_m.php,这里文件名也可随意。

3、打开新的search_m.php文件,找到:

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

改成:

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

4、在新的arc.searchview.class_m.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_m.htm";

5、在搜索模板找到相应代码按如下所示更改:

<form action="{dede:global.cfg_cmsurl/}/plus/search_m.php" name="formsearch"> <input type="hidden" name="kwtype" value="0"/> <input type="hidden" name="mobile" value="1" /> <input type="text" name="q" class="txt fl" placeholder="想看什么?输入名称试试..."> <input type="submit" name="button" class="btn fr"> </form>

注意:搜索模板名称要改成“search_m.htm”,search_m.php是PC目录下的文件,另外css、js、images路径需要更改。

以上操作完成,如有搜索结果页面的分页无法使用自带标签控制,可以按如下方法修改:

在新的arc.searchview.class_m.php文件中大概856行找打找到:

//获得上一页和下一页的链接 if($this->PageNo != 1)

这里可以去掉td标签修改成自己想要的样式。

继续找到876行一直到906行左右:

//获得数字链接 $listdd=""; $total_list = $list_len * 2 + 1; if($this->PageNo >= $total_list) { $j = $this->PageNo - $list_len; $total_list = $this->PageNo + $list_len; if($total_list > $totalpage) { $total_list = $totalpage; } } else { $j=1; if($total_list > $totalpage) { $total_list = $totalpage; } } for($j; $j<=$total_list; $j++) { if($j == $this->PageNo) { $listdd.= "<td>$j&nbsp;</td>\r\n"; } else { $listdd.="<td><a href='".$purl."PageNo=$j'>[".$j."]</a>&nbsp;</td>\r\n"; } }

这一段代码全部注释或者删掉。

继续找到916到920行直接的代码并注释或者删掉。

if($totalpage>$total_list) { $plist.="<td width='38'><input type='text' name='PageNo' style='width:28px;height:14px' value='".$this->PageNo."' /></td>\r\n"; $plist.="<td width='30'><input type='submit' name='plistgo' value='GO' style='width:30px;height:22px;font-size:9pt' /></td>\r\n"; }

至此,全部完成。

相关标签调用

收缩