導(dǎo)讀:織夢(mèng)技術(shù)織夢(mèng)技術(shù)織夢(mèng)dedecms定時(shí)更新首頁(yè)生成HTML的方法第一步調(diào)用隨機(jī)文章:織夢(mèng)給出了隨機(jī)文章調(diào)用的參數(shù)如下:{dede:arclist sort='rand' titdede織夢(mèng)模板dede商城模板。

織夢(mèng)dedecms定時(shí)更新首頁(yè)生成HTML的方法第一步調(diào)用隨機(jī)文章:織夢(mèng)給出了隨機(jī)文章調(diào)用的參數(shù)如下:{dede:arclist sort='rand' titlelen=48 row=16}<li><a href="[field:arcurl/]" title="[field:title/]" target="_blank">[field:title/]</a></li>{/dede:arclist}這段列表代碼可以調(diào)用出隨機(jī)文章,并且在每次刷新動(dòng)態(tài)頁(yè)面的時(shí)候都會(huì)變化,但是由于織夢(mèng)是首頁(yè)生成靜態(tài)htm織夢(mèng)模板安裝l的,所以如果不去手動(dòng)生成還是不會(huì)變化,這樣就用到了下面的方法。第二步設(shè)置定時(shí)自動(dòng)更新文件:復(fù)制下面代碼,粘貼到一個(gè)新文件中,命名為:autoindex.php,上傳到ftp的plus文件夾中,看清楚一點(diǎn)是plus文件夾中,錯(cuò)了位置不會(huì)生效:<?php function sp_input( $text ){$text = trim( $text );$text = htmlspecialchars( $text );if (!get_magic_quotes_gpc())return addslashes( $text );else return $text;}$autotime = 10800;//自動(dòng)更新時(shí)間,單位為秒$fpath = "../data/last_time.inc";//記錄更新時(shí)間文件,如果不能達(dá)到目的,請(qǐng)檢查是否有讀取權(quán)限。include( $fpath );if( empty($last_time))$last_time = 0;if( sp_input($_GET['renew'])=="now")$last_time = 0;if((time()-$last_time)>=$autotime ){define('DEDEADMIN', ereg_replace("[/\\]{1,}",'/',dirname(__FILE__) ) );require_once(DEDEADMIN."/../include/common.inc.php");require_once(DEDEINC."/arc.partview.class.php");/*$row = $dsql->GetOne("Select * From dede_homepageset");$dsql->Close();$templet=$row['templet'];$position=$row['position'免費(fèi)織夢(mèng)模板];*/$templet = “downpk/index.htm”;//這里是首頁(yè)dede58模板模板位置,當(dāng)前是dede默認(rèn)首面位置。$position = "../index.html";$homeFile = dirname(__FILE__)."/".$position;$homeFile = str_replace("\\", "/", $homeFile );$homeFile = str_replace( "http://", "/", $homeFile );$pv = new PartView();$pv ->SetTemplet( $cfg_basedir.$cfg_templets_dir."/".$templet );$pv -> SaveToHtml( $homeFile );$pv -> Close();$file = fopen( $fpath, "w");fwrite( $file, "<?php\n");fwrite( $file,"\$last_time=".time().";\n");fwrite( $file, '?>' );fclose( $file );}?>然后我們需要在首頁(yè)的模版代碼head標(biāo)簽中加入一段代碼:<script src="/plus/autoindex.php" type="text/javascript"></script>然后點(diǎn)擊后臺(tái)生成,更新首頁(yè)。接下來(lái)后等待時(shí)間的驗(yàn)證結(jié)果
|
相關(guān)dede織夢(mèng)模板dede商城模板。
關(guān)鍵詞標(biāo)簽: 標(biāo)簽 織夢(mèng) 首頁(yè)
聲明: 本文由我的SEOUC技術(shù)文章主頁(yè)發(fā)布于:2023-07-20 ,文章織夢(mèng)dedecms定時(shí)更新首頁(yè)生成HTML的方法,織夢(mèng)技術(shù)主要講述首頁(yè),標(biāo)簽,織夢(mèng)網(wǎng)站建設(shè)源碼以及服務(wù)器配置搭建相關(guān)技術(shù)文章。轉(zhuǎn)載請(qǐng)保留鏈接: http://www.bifwcx.com/article/web_32103.html