DedeCMS实现每分钟审核一篇文章并生成首页

网站广告招租
DedeCMS发布文章时通常是发布即审核,dede每分钟审核一篇文章并生成首页的实现方法对于使用dedecms采集功能的网站更有利,感兴趣的朋友不仿试试!

  首页在plus下新建文件 makeid.php 内容如下:

<?php$lasttime=filemtime($_SERVER./index.html”);$interval=180;//更新时间秒为单位180秒=3分钟 3分钟审核一篇if((time-$lasttime)>$interval){require_once(dirname(__FILE__)./../include/common.inc.php”);$row = $dsql->GetOne(“select id from`dede_archives` where arcrank = -1); // 找到未审核的文章排序根据你的要求修改下$aid= $row;if($aid!=){//审核文章$upquery = “Update `dede_archives` set arcrank =0 where id=’$aid’;;$upquery1 = “Update `dede_arctiny` set arcrank =0 where id=’$aid’;;$rs = $dsql->ExecuteNoneQuery($upquery);$rs1 = $dsql->ExecuteNoneQuery($upquery1);$isremote= (empty($isremote)? 0: $isremote);function MakeArt($aid, $mkindex=FALSE, $ismakesign=FALSE, $isremote=0){global $envs, $typeid;require_once(DEDEINC./arc.archives.class.php’);if($ismakesign) $envs = ‘yes’;$arc = new Archives($aid);$reurl = $arc->MakeHtml($isremote);return $reurl;}$arcID=$aid;$artUrl = MakeArt($aid,true,true,$isremote);require_once(DEDEINC./arc.partview.class.php’);$envs = $_sys_globals = array;$envs = 0;$pv = new PartView;$row = $pv->dsql->GetOne(‘SELECT * FROM `#@__homepageset`’);$templet = str_replace({style}, $cfg_df_style, $row);$homeFile = dirname(__FILE__)./.$row;$homeFile = str_replace(//”, “/”, str_replace(“”, “/”, $homeFile));$fp = fopen($homeFile, ‘w’) or die(“无法更新网站主页到:$homeFile 位置”);fclose($fp);$tpl = $cfg_basedir.$cfg_templets_dir./.$templet;if(!file_exists($tpl)){$tpl = $cfg_basedir.$cfg_templets_dir./default/index.htm’;if(!file_exists($tpl)) exit(“无法找到主页模板:$tpl “);}$GLOBALS = ‘index’;$pv->SetTemplet($tpl);$pv->SaveToHtml($homeFile);$pv->Close;exit;}else exit;}?>
  然后在首页模板里面最后面加入:

<script src=/plus/mkaid.php” language=”javascript”></script>
  这样 就可以了,方法比较简单也比较实用。

支付宝转账赞助

支付宝扫一扫赞助

微信转账赞助

微信扫一扫赞助

留言与评论(共有 0 条评论)
   
验证码: