雷火电竞-中国电竞赛事及体育赛事平台

歡迎來(lái)到入門教程網(wǎng)!

dedecms

當(dāng)前位置:主頁(yè) > CMS教程 > dedecms >

織夢(mèng)DEDECMS手機(jī)端生成靜態(tài)頁(yè)面方法

來(lái)源:本站原創(chuàng)|時(shí)間:2021-08-05|欄目:dedecms|點(diǎn)擊:

實(shí)現(xiàn)手機(jī)端(wap版)靜態(tài)生成
一、添加后臺(tái)導(dǎo)航欄目鏈接
 
1 打開(kāi)dede/inc/inc_menu.php,在146行下面添加代碼: <m:item name='更新WAP主頁(yè)' link='makehtml_homepagewap.php' rank='sys_MakeHtml' target='main' /> <m:item name='更新WAP欄目' link='makehtml_listwap.php' rank='sys_MakeHtml' target='main' /> <m:item name='更新WAP文檔' link='makehtml_archiveswap.php' rank='sys_MakeHtml' target='main' />
 
二、更新WAP主頁(yè)
 
1.復(fù)制文件dede/makehtml_homepage.php,重命名為makehtml_homepagewap.php2.打開(kāi)makehtml_homepagewap.php,找到最后一行
 
include DedeInclude('templets/makehtml_homepage.htm');
修改為
 
include DedeInclude('templets/makehtml_homepagewap.htm');
3.復(fù)制文件dede/templets/makehtml_homepage.htm,重命名為makehtml_homepagewap.htm
 
4打開(kāi)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">
4.修改36行,指定生成WAP主頁(yè)模板
 
<input name="templet" type="text" id="templet" style="width:300" value="default/wap.htm">
5.修改48行,指定生成WAP主頁(yè)路徑 
 
<td height="20" valign="top" bgcolor="#FFFFFF"><input name="position" type="text" id="position" value="../m/index.html" size="30">
6.修改69~70行,“checked”移到“不保存當(dāng)前選項(xiàng)”,系統(tǒng)默認(rèn)是提交保存主頁(yè)模板和路徑數(shù)據(jù)的
 
<input name="saveset" type="radio" value="0" class="np" checked>
不保存當(dāng)前選項(xiàng)
 
<input name="saveset" type="radio" class="np" value="1" >
保存當(dāng)前選項(xiàng)
 
END
 
三、更新WAP欄目頁(yè)
1.復(fù)制文件dede/makehtml_list.php,重命名為makehtml_listwap.php
 
2.打開(kāi)makehtml_listwap.php,找到最后一行
 
include DedeInclude('templets/makehtml_list.htm');
修改為
 
include DedeInclude('templets/makehtml_listwap.htm');
3.復(fù)制文件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.復(fù)制dede/makehtml_list_action.php 重命名makehtml_listwap_action.php
 
require_once(DEDEINC."/arc.listview.class.php");
修改為
 
require_once(DEDEINC."/arc.listwapview.class.php");
5.復(fù)制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 "模板文件不存在,無(wú)法解析文檔!"; exit(); }
 
替換為
 
為 $tempfile = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir']."/".$GLOBALS['cfg_df_style']."/list_wap.htm";
修改欄目?jī)?chǔ)存目錄,在658-659行后面添加代碼,生成的欄目文件保存在文件夾“m”下面
 
$typedir = MfTypedir('/m/'.$typedir);
修改
 
function GetMakeFileRule($typeid,$wname,$typedir,$defaultname,$namerule2)
{
$typedir = MfTypedir('/m/'.$typedir);
if($wname=='index')
代碼345-371行是把list第一頁(yè)復(fù)制為首頁(yè)index.html的,修改354行修改復(fù)制保存路徑,在$this->Fields['typedir'])前面添加'/m/'. 如下面10行所示
if($startpage==1)
{
//如果列表啟用封面文件,復(fù)制這個(gè)文件第一頁(yè)
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'];
//如果啟用遠(yuǎn)程發(fā)布則需要進(jìn)行判斷
if($cfg_remote_site=='Y'&& $isremote == 1)
{
//分析遠(yuǎn)程文件路徑
$remotefile = $murl;
$localfile = '..'.$remotefile;
$remotedir = preg_replace('/[^/]*.html/', '',$remotefile);
//不相等則說(shuō)明已經(jīng)切換目錄則可以創(chuàng)建鏡像
$this->ftp->rmkdir($remotedir);
$this->ftp->upload($localfile, $remotefile, 'acii');
}
$indexname = $this->GetTruePath().$murl;
copy($list_1,$indexname);
}
}
return $murl;
}
 
四、更新WAP文檔
1.復(fù)制dede/makehtml_archives.php 重命名為makehtml_archiveswap.php 修改最后一行
 
include DedeInclude('templets/makehtml_archives.htm');
修改為
 
include DedeInclude('templets/makehtml_archiveswap.htm');
2.復(fù)制dede/templets/makehtml_archives.htm 重命名為makehtml_archiveswap.htm 修改13行form提交地址
 
<form name="form1" action="makehtml_archives_action.php" method="get" target='stafrm'>
修改為
 
<form name="form1" action="makehtml_archiveswap_action.php" method="get" target='stafrm'>
3.復(fù)制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.復(fù)制include/arc.archives.class.php 重命名為arc.archiveswap.class.php修改文章頁(yè)儲(chǔ)存位置,476行,站點(diǎn)真實(shí)路徑后面添加"/m/" 如下第9行所示:
 
修改獲得模板文件位置,屏蔽528-536行代碼,后面添加調(diào)用模版路徑
 
function GetTruePath()
{
$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';
 
是將上面的代碼注釋掉
 
注意事項(xiàng)
DEDEcms手機(jī)目錄是m

你也可以直接使用插件
http://www.jygsgssxh.com/dedecj/5983.html
 

上一篇:dedecms織夢(mèng)動(dòng)態(tài)獲取關(guān)鍵詞無(wú)效解決方法

欄    目:dedecms

下一篇:織夢(mèng)CMS網(wǎng)站搬家教程詳解

本文標(biāo)題:織夢(mèng)DEDECMS手機(jī)端生成靜態(tài)頁(yè)面方法

本文地址:http://www.jygsgssxh.com/a1/dedecms/15154.html

更多dedecms

您可能感興趣的文章

閱讀排行

本欄相關(guān)

隨機(jī)閱讀

網(wǎng)頁(yè)制作CMS教程網(wǎng)絡(luò)編程軟件編程腳本語(yǔ)言數(shù)據(jù)庫(kù)服務(wù)器

如果侵犯了您的權(quán)利,請(qǐng)與我們聯(lián)系,我們將在24小時(shí)內(nèi)進(jìn)行處理、任何非本站因素導(dǎo)致的法律后果,本站均不負(fù)任何責(zé)任。

聯(lián)系QQ:835971066 | 郵箱:835971066#qq.com(#換成@)

Copyright © 2002-2020 腳本教程網(wǎng) 版權(quán)所有