国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > CMS > 織夢DEDE > 正文

織夢模板二次開發(fā) 手機(jī)生成靜態(tài)頁面

2024-07-12 08:48:38
字體:
供稿:網(wǎng)友
這篇文章主要為大家詳細(xì)介紹了織夢模板二次開發(fā) 手機(jī)生成靜態(tài)頁面,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下,有需要的朋友可以收藏方便以后借鑒。

織夢手機(jī)模板的應(yīng)用已經(jīng)出來不少時(shí)間了,市面上已經(jīng)有了很多的織夢手機(jī)模板,但是這一些模板基本就是基于織夢官網(wǎng)的動(dòng)態(tài)瀏覽機(jī)制,是動(dòng)態(tài)的,卻不能像PC端的織夢模板一樣,可以實(shí)現(xiàn)全站靜態(tài)生成,方便SEO。就這個(gè)情況,361模板下面給出手機(jī)生成靜態(tài)頁面解決訪案。

  先做個(gè)簡單的說明,這個(gè)方案并非361模板原創(chuàng),請有需求的朋友有選擇的使用。

實(shí)現(xiàn)wap手機(jī)靜態(tài)生成

第一步、添加后臺(tái)導(dǎo)航欄目鏈接

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

<m:item name='更新WAP主頁' 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主頁

1.復(fù)制文件dede/makehtml_homepage.php,重命名為makehtml_homepagewap.php

2.打開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.打開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主頁模板

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

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”移到“不保存當(dāng)前選項(xiàng)”,系統(tǒng)默認(rèn)是提交保存主頁模板和路徑數(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)

第三部、更新WAP欄目

1.復(fù)制文件dede/makehtml_list.php,重命名為makehtml_listwap.php

2.打開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']."st_default.htm";        }        if(!file_exists($tempfile)||!is_file($tempfile))        {            echo "模板文件不存在,無法解析文檔!";            exit();        }

替換為

$tempfile = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir']."/".$GLOBALS['cfg_df_style']."st_wap.htm";

修改欄目儲(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第一頁復(fù)制為首頁index.html的,修改354行修改復(fù)制保存路徑,在$this->Fields['typedir'])前面添加'/m/'. 如下面10行所示

if($startpage==1){//如果列表啟用封面文件,復(fù)制這個(gè)文件第一頁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);//不相等則說明已經(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

修改文章頁儲(chǔ)存位置,476行,站點(diǎn)真實(shí)路徑后面添加"/m/" 如下第9行所示:

    /**     *  獲得站點(diǎn)的真實(shí)根路徑     *     * @access    public     * @return    string     */    function GetTruePath()    {        $TRUEpath = $GLOBALS["cfg_basedir"].'/m/';        return $TRUEpath;    }

修改獲得模板文件位置,屏蔽528-536行代碼,后面添加調(diào)用模版路徑

/*  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)

DEDE手機(jī)目錄是M。

到這里就介紹完了手機(jī)生成靜態(tài)頁面的全部改造過程,最后再強(qiáng)調(diào)一下,本文并非361模板原創(chuàng),所有對改造的可行性不負(fù)責(zé),有興趣嘗試的朋友一定要注意文件的備份以免造成不必要的損失。

以上就是織夢模板二次開發(fā) 手機(jī)生成靜態(tài)頁面的全部內(nèi)容,希望對大家的學(xué)習(xí)和解決疑問有所幫助,也希望大家多多支持武林網(wǎng)。
發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 斗六市| 英吉沙县| 康乐县| 班戈县| 龙井市| 垣曲县| 普洱| 法库县| 宣威市| 泽普县| 神池县| 台中县| 万宁市| 海门市| 茌平县| 突泉县| 阿拉善左旗| 诸城市| 珲春市| 台北县| 凯里市| 诸城市| 沂南县| 拉孜县| 峨山| 华蓥市| 公安县| 阳江市| 会泽县| 张家港市| 漳平市| 秦皇岛市| 江城| 灵璧县| 洛浦县| 铜山县| 沙坪坝区| 青川县| 尼木县| 虎林市| 清徐县|