实现wap手机静态生成
一、添加后台导航栏目链接
1 打开dede/inc/inc_menu.php,在146行下面添加代码:
<m:itemname='更新wap主页'link='makehtml_homepagewap.php'rank='sys_makehtml'target='main'/> <m:itemname='更新wap栏目'link='makehtml_listwap.php'rank='sys_makehtml'target='main'/> <m:itemname='更新wap文档'link='makehtml_archiveswap.php'rank='sys_makehtml'target='main'/>二、更新wap主页
1.复制文件dede/makehtml_homepage.php,重命名为makehtml_homepagewap.php2.打开makehtml_homepagewap.php,找到最后一行
include dedeinclude('templets/makehtml_homepage.htm');
修改为
include dedeinclude('templets/makehtml_homepagewap.htm');
3.复制文件dede/templets/makehtml_homepage.htm,重命名为makehtml_homepagewap.htm
4打开dede/templets/makehtml_homepagewap.htm 修改21行
<form action="makehtml_homepage.php" method="post" name="form1" target="stafrm">
修改为
<form action="makehtml_homepagewap.php" method="post" name="form1" target="stafrm">
3
4.修改36行,指定生成wap主页模板
<input name="templet" type="text" id="templet" style="width:300" value="default/wap.htm">
4
5.修改48行,指定生成wap主页路径
<td height="20" valign="top" bgcolor="#ffffff"><input name="position" type="text" id="position" value="../m/index.html" size="30">
6.修改69~70行,“checked”移到“不保存当前选项”,系统默认是提交保存主页模板和路径数据的
<input name="saveset" type="radio" value="0" class="np" checked>
不保存当前选项
<input name="saveset" type="radio" class="np" value="1" >
保存当前选项
end
三、更新wap栏目
1.复制文件dede/makehtml_list.php,重命名为makehtml_listwap.php
2.打开makehtml_listwap.php,找到最后一行
include dedeinclude('templets/makehtml_list.htm');
修改为
include dedeinclude('templets/makehtml_listwap.htm');
3.复制文件dede/templets/makehtml_list.htm重命名为makehtml_listwap.htm ,修改第10行
<form name="form1" action="makehtml_list_action.php" method="get" target='stafrm'>
修改为
<form name="form1" action="makehtml_listwap_action.php" method="get" target='stafrm'>
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['typedir'])前面添加'/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['typedir'],'',$this->fields['namerule2']);
$onlyrule = str_replace("{page}","1",$onlyrule);
$list_1 = $this->gettruepath.$onlyrule;
$murl = mftypedir('/m/'.$this->fields['typedir']).'/'.$this->fields['defaultname'];
//如果启用远程发布则需要进行判断
if($cfg_remote_site=='y'&& $isremote == 1)
{
//分析远程文件路径
$remotefile = $murl;
$localfile = '..'.$remotefile;
$remote