dedecms自動生成首頁靜態(tài)的方法,織夢文章
導(dǎo)讀:織夢文章織夢文章最近將網(wǎng)站改版,用了dedecms程序,看了下首頁文件,發(fā)現(xiàn)沒有自動生成靜態(tài)首頁文件index.html ,這樣如果刪除了index.html,那么訪問網(wǎng)站,則織夢模板免費下裁織夢文章模板。
最近將網(wǎng)站改版,用了dedecms程序,看了下首頁文件,發(fā)現(xiàn)沒有自動生成靜態(tài)首頁文件index.html ,這樣如果刪除了index.h織夢的模板tml,那么訪問網(wǎng)站,則會出現(xiàn)首頁404錯誤。故修改了首頁程序,加上了判斷,讓程序可以自動生成首頁文件! 代碼如下:
<?php if(!file_exists(dirname(__FILE__).dede免費校板下戰(zhàn)’/data/common.inc.php’)) { header(‘Location:install/index.php’); exit(); } //自動生成HTML版,加上 //!file_exists(dirname(__FILE__).’/index.html’),如果不存在index.html,則自動生成index.html if(isset($_GET['upcache']) || !file_exists(dirname(__FILE__).’/index.html’)) { require_once (dirname(__FILE__) . "/include/common.inc.php"); require_once DEDEINC."/arc.partview.class.php"; $GLOBALS['_arclistEnv'] = ‘index’; $row = $dsql->GetOne("Select * From `dede_homepageset`"); $row['templet'] = MfTemplet($row['templet']); $pv = new PartView(); $pv->SetTemplet($cfg_basedir . $cfg_templets_dir . "/" . $row['templet']); $pv->SaveToHtml(dirname(__FILE__).’/index.html’); include(di織夢模板網(wǎng)站rname(__FILE__).’/index.html’); exit(); } else { header(‘HTTP/1.1 301 Moved Permanently’); header(‘Location:index.html’); } ?> 加 上!file_exists(dirname(__FILE__).’/index.html’) 這句即可實現(xiàn)自動生成index.html . 當然沒有這句也沒太大的問題,但是萬一不小心刪掉了index.html,而有沒有及時的生成index.html ,那么問題就出現(xiàn)了。
相關(guān)織夢模板免費下裁織夢文章模板。聲明: 本文由我的SEOUC技術(shù)文章主頁發(fā)布于:2023-07-22 ,文章dedecms自動生成首頁靜態(tài)的方法,織夢文章主要講述首頁,自動生成,織夢網(wǎng)站建設(shè)源碼以及服務(wù)器配置搭建相關(guān)技術(shù)文章。轉(zhuǎn)載請保留鏈接: http://www.bifwcx.com/article/web_33960.html