我爱自学

 找回密码
 会员注册

QQ登录

只需一步,快速开始

dede织梦手机端静态HTML生成之-移动静态列表

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

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

include DedeInclude('templets/makehtml_list.htm');

修改为

include DedeInclude('templets/makehtml_list_m.htm');

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

<form name="form1" action="makehtml_list_action.php" method="get" target='stafrm'>

修改为

<form name="form1" action="makehtml_list_action_m.php" method="get" target='stafrm'>

4.复制dede/makehtml_list_action.php 重命名makehtml_list_action_m.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_default_m.htm";

变更实现的功能是定义静态列表文件的模板为default目录下的list_default_m.htm文件,因此default

目录下需建立该模板问题件。
以上代码实现的固定模板文件,如果需要根据栏目不同进行变更,可以综合使用str_replace函数。

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

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

修改

function GetMakeFileRule($typeid,$wname,$typedir,$defaultname,$namerule2)

    {

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

     if($wname=='index')

该文件中有几处创建目录的代码

CreateDir(MfTypedir($this->Fields['typedir']));

修改为:CreateDir(MfTypedir('/m/'.$this->Fields['typedir']));


代码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;

$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;
}

点击阅读更多内容!
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 会员注册

本版积分规则

手机版|小黑屋|我爱自学 ( 蜀ICP备19015358号-3 )

GMT+8, 2024-4-26 20:18 , Processed in 0.053996 second(s), 24 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

本站大部分教程是网站原创教程,一部分教程为我爱自学(http://www.5izixue.com)编辑收集整理。

如果您需要转载我爱自学网站教程,请注明“资料来源:我爱自学(5izixue)”字样并注明本站网址。

编辑收集整理的教程版权归原作者所有,本站只提供网友交流学习使用,请勿用于商业用途,如果该文章有任何侵犯您权益的地方,请联系我们(569705694@qq.com),我们将在第一时间进行处理!谢谢您的支持!

快速回复 返回顶部 返回列表