织梦手机站搜索后显示是电脑端的搜索结果模板的解决方法

有使用织梦dedecms最新程序移动版的同学肯定遇到过,手机版搜索结果跳转到的是电脑版搜索结果页面去了。

解决方法

1、在手机站模板的搜索框代码上加入 <input type="hidden" name="mobile" value="1" />

     action用电脑站的/plus/search.php ,如下

<form name="formsearch" action="{dede:global.cfg_basehost/}/plus/search.php">
    <input type="hidden" name="pagesize" value="15">
    <input type="hidden" name="kwtype" value="0"/>
    <input type="hidden" name="mobile" value="1" />
    <input name="q" type="text" placeholder="输入关键词">
    <button type="submit">搜索</button>
</form>


2、打开 /plus/search.php 找到

$mid = (isset($mid) && is_numeric($mid)) ? $mid : 0;

在它的下面加入

if($mobile==1) define('DEDEMOB', 'Y');

3、打开 /include/arc.searchview.class.php 找到

$purl .= "?".$geturl;

在它上面加入

if(defined('DEDEMOB'))$geturl .= "mobile=1&";

这样修改后,织梦移动站的搜索结果模板就是 search_m.htm ,搜索结果就可以显示为移动站的了。