700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > 织梦DedeCMS手机端生成静态页面方法

织梦DedeCMS手机端生成静态页面方法

时间:2020-12-03 19:49:29

相关推荐

织梦DedeCMS手机端生成静态页面方法

实现手机端(wap版)静态生成

一 | 添加后台导航栏目链接

1 打开dede/inc/inc_menu.php,在146行下面添加代码:

二 | 更新WAP主页

1.复制文件dede/makehtml_homepage.php,重命名为makehtml_homepagewap.php2.打开makehtml_homepagewap.php,找到最后一行

include DedeInclude( emplets/makehtml_homepage.htm);

修改为

include DedeInclude( emplets/makehtml_homepagewap.htm);

3.复制文件dede/templets/makehtml_homepage.htm,重命名为makehtml_homepagewap.htm

4打开dede/templets/makehtml_homepagewap.htm 修改21行

修改为

4.修改36行,指定生成WAP主页模板

5.修改48行,指定生成WAP主页路径

6.修改69~70行,”checked”移到”不保存当前选项”,系统默认是提交保存主页模板和路径数据的

不保存当前选项

保存当前选项

END

三 | 更新WAP栏目页

1.复制文件dede/makehtml_list.php,重命名为makehtml_listwap.php

2.打开makehtml_listwap.php,找到最后一行

include DedeInclude( emplets/makehtml_list.htm);

修改为

include DedeInclude( emplets/makehtml_listwap.htm);

3.复制文件dede/templets/makehtml_list.htm 重命名为makehtml_listwap.htm ,修改第10行

修改为

4.复制dede/makehtml_list_action.php 重命名makehtml_listwap_action.php

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

修改为

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

5.复制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";

修改栏目储存目录,在658-659行后面添加代码,生成的栏目文件保存在文件夹”m”下面

$typedir = MfTypedir(/m/.$typedir);

修改

function GetMakeFileRule($typeid,$wname,$typedir,$defaultname,$namerule2){$typedir = MfTypedir(/m/.$typedir);if($wname==index)代码345-371行是把list第一页复制为首页index.html的,修改354行修改复制保存路径,在$this->Fields[ ypedir])前面添加/m/. 如下面10行所示if($startpage==1){//如果列表启用封面文件,复制这个文件第一页if($this->TypeLink->TypeInfos[isdefault]==1&& $this->TypeLink->TypeInfos[ispart]==0){$onlyrule = $this->GetMakeFileRule($this->Fields[id],"list",$this->Fields[ ypedir],\,$this->Fields[ amerule2]);$onlyrule = str_replace("{page}","1",$onlyrule);$list_1 = $this->GetTruePath().$onlyrule;$murl = MfTypedir(/m/.$this->Fields[ ypedir])./.$this->Fields[defaultname];//如果启用远程发布则需要进行判断if($cfg_remote_site==Y&& $isremote == 1){//分析远程文件路径$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_1,$indexname);}}return $murl;}

四 | 更新WAP文档

1.复制dede/makehtml_archives.php 重命名为makehtml_archiveswap.php 修改最后一行

include DedeInclude( emplets/makehtml_archives.htm);

修改为

include DedeInclude( emplets/makehtml_archiveswap.htm);

2.复制dede/templets/makehtml_archives.htm 重命名为makehtml_archiveswap.htm 修改13行form提交地址

修改为

3.复制dede/makehtml_archives_action.php 重命名为makehtml_archiveswap_action.php 修改13行

require_once(DEDEINC.”/arc.archives.class.php”);

修改为

require_once(DEDEINC.”/arc.archiveswap.class.php”);

4.复制include/arc.archives.class.php 重命名为arc.archiveswap.class.php修改文章页储存位置,476行,站点真实路径后面添加”/m/” 如下第9行所示:

修改获得模板文件位置,屏蔽528-536行代码,后面添加调用模版路径

function GetTruePath(){$TRUEpath = $GLOBALS["cfg_basedir"]./m/;return $TRUEpath;}

/* if(!empty($this->Fields[ emplet])){ $filetag = MfTemplet($this->Fields[ emplet]);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

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。