• 全国400电话网上服务平台
    强大号码库资源任选,方便,快捷,快速开通。
    咨询热线:400-1100-266  

    织梦手机站搜索与PC同步的方法
    POST TIME:2021-05-23 00:42

    之前介绍过织梦手机站搜索与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";
    }

    至此,全部完成。

    
    关于我们 | 付款方式 | 建站知识 | 增值服务 | 网站模板
    Copyright © 2003-2016
    时间:9:00-21:00 (节假日不休)
    版权所有:巨人网络(扬州)科技有限公司
    总部地址:江苏省信息产业基地11号楼四层
    《增值电信业务经营许可证》 苏B2-20120278
    X

    截屏,微信识别二维码

    微信号:veteran88

    (点击微信号复制,添加好友)

     打开微信

    微信号已复制,请打开微信添加咨询详情!