织梦DEDECMS手机端生成静态页面方法
I..添加后台导航栏目链接
I.打开dede/inc/inc_menu.php,在I.IVVI行下面添加代码:
更多精彩就在: 51免费论文网|www.jxszl.com
arget=main/>
II.更新WAP主页
I..复制文件dede/makehtml_homepage.php,重命名为makehtml_homepagewap.phpII.打开makehtml_homepagewap.php,找到最后I.行
includeDedeInclude(templets/makehtml_homepage.htm);
修改为
includeDedeInclude(templets/makehtml_homepagewap.htm);
III.复制文件dede/templets/makehtml_homepage.htm,重命名为makehtml_homepagewap.htm
IV打开dede/templets/makehtml_homepagewap.htm修改III.行
修改为
IV.修改IIIVI行,指定生成WAP主页模板
V.修改IVVIII行,指定生成WAP主页路径
VI.修改VIIX~VII0行,checked"移到不保存当前选项",系统默认是提交保存主页模板和路径数据的
不保存当前选项
保存当前选项
END
III.更新WAP栏目页
I..复制文件dede/makehtml_list.php,重命名为makehtml_listwap.php
II.打开makehtml_listwap.php,找到最后I.行
includeDedeInclude(templets/makehtml_list.htm);
修改为
includeDedeInclude(templets/makehtml_listwap.htm);
III.复制文件dede/templets/makehtml_list.htm重命名为makehtml_listwap.htm,修改第I.0行
修改为
IV.复制dede/makehtml_list_action.php重命名makehtml_listwap_action.php
require_once(DEDEINC."/arc.listview.class.php");
修改为
require_once(DEDEINC."/arc.listwapview.class.php");
V.复制include/arc.listview.class.php重命名为arc.listwapview.class.php
if(!file_exists($tempfile)){$tempfile=$GLOBALS[cfg_basedir].$GLOBALS[cfg_templets_dir]."/".$GLOBALS[cfg_df_style]."/list_default.htm";}if(!file_exists($tempfile)||!is_file($tempfile)){echo"模板文件不存在,无法解析文档!";exit();}
替换为
为$tempfile=$GLOBALS[cfg_basedir].$GLOBALS[cfg_templets_dir]."/".$GLOBALS[cfg_df_style]."/list_wap.htm";
修改栏目储存目录,在VIVVIII-VIVIX行后面添加代码,生成的栏目文件保存在文件夹m"下面
$typedir=MfTypedir(/m/.$typedir);
修改
functionGetMakeFileRule($typeid,$wname,$typedir,$defaultname,$nameruleII)
{
$typedir=MfTypedir(/m/.$typedir);
if($wname==index)
代码IIIIVV-IIIVIII.行是把list第I.页复制为首页index.html的,修改IIIVIV行修改复制保存路径,在$this->Fields[typedir])前面添加/m/.如下面I.0行所示
if($startpage==I.)
{
//如果列表启用封面文件,复制这个文件第I.页
if($this->TypeLink->TypeInfos[isdefault]==I.
&&$this->TypeLink->TypeInfos[ispart]==0)
{
$onlyrule=$this->GetMakeFileRule($this->Fields[id],"list",$this->Fields[typedir],,$this->Fields[nameruleII]);
$onlyrule=str_replace("{page}","I.",$onlyrule);
$list_I.=$this->GetTruePath().$onlyrule;
$murl=MfTypedir(/m/.$this->Fields[typedir])./.$this->Fields[defaultname];
//如果启用远程发布则需要进行判断
if($cfg_remote_site==Y&&$isremote==I.)
{
//分析远程文件路径
$remotefile=$murl;
$localfile=...$remotefile;
$remotedir=preg_replace(/[^/]*.html/,,$remotefile);
//不相等则说明已经切换目录则可以创建镜像
$this->ftp->rmkdir($remotedir);
$this->ftp->upload($localfile,$remotefile,acii);
}
$indexname=$this->GetTruePath().$murl;
copy($list_I.,$indexname);
}
}
return$murl;
}
IV.更新WAP文档
I..复制dede/makehtml_archives.php重命名为makehtml_archiveswap.php修改最后I.行
includeDedeInclude(templets/makehtml_archives.htm);
修改为
includeDedeInclude(templets/makehtml_archiveswap.htm);
II.复制dede/templets/makehtml_archives.htm重命名为makehtml_archiveswap.htm修改I.III行form提交地址
修改为
III.复制dede/makehtml_archives_action.php重命名为makehtml_archiveswap_action.php修改I.III行
require_once(DEDEINC."/arc.archives.class.php");
修改为
require_once(DEDEINC."/arc.archiveswap.class.php");
IV.复制include/arc.archives.class.php重命名为arc.archiveswap.class.php修改文章页储存位置,IVVIIVI行,站点真实路径后面添加"/m/"如下第IX行所示:
修改获得模板文件位置,屏蔽VIIVIII-VIIIVI行代码,后面添加调用模版路径
functionGetTruePath()
{
$TRUEpath=$GLOBALS["cfg_basedir"]./m/;
return$TRUEpath;
}
/*if(!empty($this->Fields[templet]))
{
$filetag=MfTemplet($this->Fields[templet]);
if(!preg_match("#/#",$filetag))$filetag=$GLOBALS[cfg_df_style]./.$filetag;
}
else
{
$filetag=MfTemplet($this->TypeLink->TypeInfos["temparticle"]);
}*/
$filetag=$GLOBALS[cfg_df_style]./.article_wap.htm;
是将上面的代码注释掉
注意事项
DEDEcms手机目录是m
你也可以直接使用插件:https://www.adminbuy.cn/dedecj/VIXVIIIIII.html
原文链接:http://www.jxszl.com/biancheng/dedecms/75331.html
热门阅读