搜索

织梦dedecms手机端首页如何更新_不更新解决方法

2019-11-2 11:19| 发布者: happyxp| 查看: 3604| 评论: 0

摘要: 使用织梦dedecms过程中,PC端的更新大家都知道,可以后台一键生成,织梦dedecms手机端首页在制作的过程中不是实时更新的,如何快速的更新呢?有两种方法:第一种: 修改dedecms一键生成主页的后台路径。 这个位置理 ...
  使用织梦dedecms过程中,PC端的更新大家都知道,可以后台一键生成,织梦dedecms手机端首页在制作的过程中不是实时更新的,如何快速的更新呢?有两种方法:
第一种:
  修改dedecms一键生成主页的后台路径。
  这个位置理论上可以生成网站的任何页面,需要选择的是主页模板和主页位置。注意PC端是index.htm而手机端是index_m.htm,这两个位置生成是对应的,如果选择错误可能导致生成之后网页无法打开的情况,如果出现错误,仔细检查一遍。

这样子就可以了,修改很简单。

第二种:

  如果你经常修改手机端主页,你感觉这样修改又太麻烦,可以后台直接添加个专门给手机端更新用的菜单。核心的操作思想是把生成PC端的文件重新复制一份,然后修改成对应的模板和生成路径即可。

A、只添加生成dedecms手机版主页功能

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

1 打开dede/inc/inc_menu.php,在143行下面添加代码(添加蓝色部分代码):

  <m:item name='更新主页HTML' link='makehtml_homepage.php' rank='sys_MakeHtml' target='main' />

  <m:item name='更新手机版主页HTML' link='makehtml_homepage_m.php' rank='sys_MakeHtml' target='main' /> 

  <m:item name='更新栏目HTML' link='makehtml_list.php' rank='sys_MakeHtml' target='main' />

二、更新手机版主页

1.复制文件dede/makehtml_homepage.php,重命名为makehtml_homepage_m.php

2.打开makehtml_homepage_m.php,找到最后一行include DedeInclude('templets/makehtml_homepage.htm');

修改为

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

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

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

<form action="makehtml_homepage.php" method="post" name="form1" target="stafrm">

修改为 

<form action="makehtml_homepage_m.php" method="post" name="form1" target="stafrm">

5.修改36行,指定生成手机版主页模板

<input name="templet" type="text" id="templet" style="width:300" value="default/index_m.htm">

6.修改48行,指定生成手机版主页路径 

<td height="20" valign="top" bgcolor="#FFFFFF"><input name="position" type="text" id="position" value="../m/index.html" size="30"> 

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

<input name="saveset" type="radio" value="0" class="np" checked> 

不保存当前选项

 <input name="saveset" type="radio" class="np" value="1" >

保存当前选项

B、添加手机版所有页面生成HTML功能

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

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

<m:item name='更新手机版主页HTML' link='makehtml_homepage_m.php' rank='sys_MakeHtml' target='main' /> 

<m:item name='更新手机版栏目HTML' link='makehtml_list_m.php' rank='sys_MakeHtml' target='main' />  

<m:item name='更新手机版文档HTML' link='makehtml_archives_m.php' rank='sys_MakeHtml' target='main' />

二、更新手机版主页

1.复制文件dede/makehtml_homepage.php,重命名为makehtml_homepage_m.php

2.打开makehtml_homepage_m.php,找到最后一行include DedeInclude('templets/makehtml_homepage.htm');

修改为

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

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

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

<form action="makehtml_homepage.php" method="post" name="form1" target="stafrm">

修改为 

<form action="makehtml_homepage_m.php" method="post" name="form1" target="stafrm">

5.修改36行,指定生成手机版主页模板

<input name="templet" type="text" id="templet" style="width:300" value="default/index_m.htm">

6.修改48行,指定生成手机版主页路径 

<td height="20" valign="top" bgcolor="#FFFFFF"><input name="position" type="text" id="position" value="../m/index.html" size="30"> 

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

<input name="saveset" type="radio" value="0" class="np" checked> 

不保存当前选项

 <input name="saveset" type="radio" class="np" value="1" >

保存当前选项

三、更新手机版栏目

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_m_action.php" method="get" target='stafrm'>

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

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

修改为

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

5.复制include/arc.listview.class.php 重命名为arc.list_mview.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_m.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;

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

}

四、更新手机版文档

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

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

修改为

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

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

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

修改为

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

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

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

修改为

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

4.复制include/arc.archives.class.php 重命名为arc.archives_m.class.php

修改文章页储存位置,476行,站点真实路径后面添加"/m/" 如下第9行所示:

    /**

     *  获得站点的真实根路径

     *

     * @access    public

     * @return    string

     */

    function GetTruePath()

    {

        $TRUEpath = $GLOBALS["cfg_basedir"].'/m/';

        return $TRUEpath;

    }

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

/*  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_m.htm';

是将上面的代码注释掉

DEDE手机目录是M

至此大功告成!

路过

雷人

握手

鲜花

鸡蛋
本站文章如无特殊说明均为 虾皮社区 原创,可无偿使用和传播,欢迎转载分享!
转载请注明本文地址:
如有文章侵犯了您的权利,请联系本站站长,我们将在第一时间删除相关内容,谢谢!

虾皮社区,成立十年了!

站长自己也搞不懂想做个什么,反正就是一直在努力的做!

Copyright © 2007-2024 xp6.org Powered by Discuz

QQ|Archiver|手机版|小黑屋|虾皮社区 |网站地图
返回顶部