require_once (dirname(__FILE__) . "/../include/common.inc.php")
$row = $dsql->GetOne("Select uptime From `cmsxx_arccache` where md5hash = 'autonew'")
if(!is_array($row)) exit(autonew(5))
$interval=60//时间 秒
if(time() - $row['uptime'] <$interval ) exit()
autonew($no)
function machom($no=''){
define('DEDEADMIN', ereg_replace("[/]{1,}",'/',dirname(__FILE__) ) )
require_once(dirname(__FILE__)."/../include/common.inc.php")
require_once(dirname(__FILE__)."/../include/arc.partview.class.php")
$dsql = new DedeSql(false)
$row = $dsql->GetOne("Select * From cmsxx_homepageset")
$dsql->Close()
$templet=$row['templet']
$position=$row['position']
$homeFile = DEDEADMIN."/".$position
$homeFile = str_replace("","/",$homeFile)
$homeFile = str_replace("//","/",$homeFile)
$templet = str_replace("{style}",$cfg_df_style,$templet)
$pv = new PartView()
$GLOBALS['_arclistEnv'] = 'index'
$pv->SetTemplet($cfg_basedir.$cfg_templets_dir."/".$templet)
$pv->SaveToHtml($homeFile)
}
function autonew($no=''){
global $dsql
$sql = "SELECT id FROM `cmsxx_archives` where arcrank >'0' limit $no "
$dsql->SetQuery($sql)
$dsql->Execute()
while($row = $dsql->GetArray()){
$id = $row['id']
$time = time() - rand(0,$interval * 10)
$dsql->ExecuteNoneQuery("Update `cmsxx_arctiny` set `arcrank`='0', `sortrank`='$time' where id = '$id'")
$dsql->ExecuteNoneQuery("Update `cmsxx_archives` set `arcrank`='0', `sortrank`='$time', `pubdate`='$time' where id = '$id'")
}
machom($no)
$dsql->ExecuteNoneQuery("Update `cmsxx_arccache` set `uptime`=".time()." where md5hash = 'autonew'")
}
?>
默认情况下是这样的,发表文章后还要手动去生成栏目页跟首页,但是显然这样很不方便,应该很多人都发布为文章就基本忘了去更新首页跟栏目页,而实际上dede后台可以进行设置的,设置完之后你每次更新文章之后系统会自动更新栏目页跟首页如上图,在后台一次点开 系统---系统基本参数--性能选项,然后拉到最下面把红色框框内的全部选中为 是,然后确定,ok一切搞定,你以后灭此发表文章之后,系统都会自动更新栏目页跟首页了
后台-系统设置-系统参数设置搜索“更新”
发布文章后马上更新网站主页:是 否 勾选是
发表文章后马上更新相关栏目:是 否勾选是
发表文章后马上更新上下篇:是 否 勾选是
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)