1、比如我们打开电脑端的plus/list.php
然后我们手机端也放一个list.php 但是手机端下就没有那些incloud 文件,根本调用不出内容
那么我们就需要
把引入文件路径往上一级引入,
require_once(dirname(__FILE__)."/../../include/common.inc.php");
需要服务器支持,一般没禁止 就都是支持的!
然后我们就会发现调用的是电脑端模板
然后我们去查看织梦生成列表的arc.listview.class.php
我们可以发现
if ( defined('DEDEMOB') ) { $tempfile =str_replace('.htm','_m.htm',$tempfile); }
那么我们可以改一下
if ( defined('DEDEMOB') ) { unset($tempfile); $dnte=$this->TypeLink->TypeInfos['templist']; $dnte =str_replace($cfg_df_style,$cfg_sj_style,$dnte); $tempfile = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir']."/".$dnte; $tempfile1=$tempfile; }
改成对应的手机端模板目录
然后在list.php中前面修改加入
define('DEDEMOB', 'Y'); require_once(dirname(__FILE__)."/../../include/common.inc.php");
2、再比如我们tags.php
路径就是同理了!
然后同样增加
define('DEDEMOB', 'Y'); require_once (dirname(__FILE__) . "/../include/common.inc.php"); require_once (DEDEINC . "/arc.taglist.class.php");
我们发现引入的是arc.taglist.class.php
我们找到arc.taglist.class.php
找到
if(!file_exists($tempfile)||!is_file($tempfile)) { echo "模板文件不存在,无法解析文档!"; exit(); }
在前面加入
if ( defined('DEDEMOB') ) { unset($tempfile); $tempfile = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir']."/".$GLOBALS['cfg_sj_style'].'/'.$this->Templet; }
如果我们增加别的端口还可以增加类似参数即可 DEDEMIP
if ( defined('DEDEMIP') ) { unset($tempfile); $tempfile = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir']."/".$GLOBALS['cfg_mip_style'].'/'.$this->Templet; }
好了 去试下吧!