elseif($ac='automakehtml'){ //自动生成首页、列表页
$time=ceil($_GET['time']);
if($time==0 || $time==''){$time=1800;}
if($_GET['type']=='index'){ //生成首页
require_once('last_config.php');
if((time()-$lasttime)>$time){
require_once(DEDEINC."/arc.partview.class.php");
$row = $dsql->GetOne("Select * From #@__homepageset");
$dsql->Close();
$templet=$row['templet'];
$position=$row['position'];
$homeFile = dirname(__FILE__)."/../".$position;
$homeFile = str_replace("\\","/",$homeFile);
$homeFile = str_replace("//","/",$homeFile);
$templet = str_replace("{style}",$cfg_df_style,$templet);
$pv = new PartView();
$pv->SetTemplet($cfg_basedir.$cfg_templets_dir."/".$templet);
echo $homeFile;
$pv->SaveToHtml($homeFile);
$pv->Close();
$file = fopen("last_config.php","w");
fwrite($file,"<?php\n");
fwrite($file,"\$lasttime=".time().";\n");
fwrite($file,'?>');
fclose($file);
}
}
elseif($_GET['type']=='templist'){ //生成列表页(注意,只生成第一页)
$id=ceil($_GET['id']);if($id=='' || $id==0){exit;}
require_once('last_config1.php');
if((time()-$templist[$id])>$time){
$thearray=$templist;
$thearray[$id]=time();
$str='Array(';
foreach($thearray as $key=>$values){
$str.=$key.'=>\''.$values.'\',';
}
$str.=')';
$file = fopen("last_config1.php","w");
fwrite($file,"<?php\n");
fwrite($file,"\$templist=".$str.";\n");
fwrite($file,'?>');
fclose($file);
require_once(DEDEINC."/arc.partview.class.php");
$row = $dsql->GetOne("Select defaultname,templist,typedir From #@__arctype where id=".$id);
$dsql->Close();
$templet=$row['templist'];
$position=$row['typedir'];
$position=str_replace('{cmspath}',DEDEINC.'/..',$position).'/'.$row['defaultname'];
$templet = str_replace("{style}",$cfg_df_style,$templet);
$pv = new PartView();
$pv->SetTemplet($cfg_basedir.$cfg_templets_dir."/".$templet);
$pv->SaveToHtml($position);
$pv->Close();
}
}
}
dedecms自动更新首页和列表页
最新推荐文章于 2023-06-02 17:45:45 发布