欢迎访问织梦学习网,加群!!!!!!!!!!!!!!!!
当前位置:主页 > 排名优化 >

织梦cms自动审核并发布文章方法(二)

2014-08-20 dedecms排名优化 织梦,cms,自动,审核,并,发布,文章,方法,二,

dedestudy.cn/' target='_blank'>织梦cms自动审核并发布文章方法(二) DEDE自动审核发布文章也很容易实现了.

<?php
//自动生成HTML版
if(isset($_GET['pub']))
{
require_once (dirname(__FILE__) . “/include/common.inc.php”);
require_once DEDEINC.”/arc.partview.class.php”;
//发布审核稿件
require_once(DEDEINC.”/arc.archives.class.php”);
for ($i=1; $i<=1; $i++) {
$row = $dsql->GetOne(“select * from `ddmx_arctiny` where arcrank = -1 order by id limit 1″);
$id = $row['id'];
$iquery = “update `dede_arctiny` set arcrank = 0 where id=’$id’”;
$dsql->ExecuteNoneQuery($iquery);
$iquery2 = “update `dede_archives` set arcrank = 0, ismake = 1 where id=’$id’”;
$dsql->ExecuteNoneQuery($iquery2);
$dsql->ExecuteNoneQuery(“Update `dede_taglist` set `arcrank` = 0 where aid=’$id’”);
$ac = new Archives($id);
$rurl = $ac->MakeHtml();
}
//更新首页
$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(dirname(__FILE__).’/index.html’);
exit();
}
else
{
header(‘HTTP/1.1 301 Moved Permanently’);
header(‘Location:index.html’);
}
?>

上面的代码主要就是更新arcrank的值. 没有发布的文章arcrank=-1. 而发布的文章arcrank=0. 所以自审核的文章就是把arcrank为-1的文章找出来, 把文章的arcrank属性变为0.

找出文件:

$row = $dsql->GetOne(“select * from `dede_arctiny` where arcrank = -1 order by id limit 1″);

改变属性:

$iquery2 = “update `dede_archives` set arcrank = 0, ismake = 1 where id=’$id’”;
$dsql->ExecuteNoneQuery($iquery2);

相关表的更新:

$dsql->ExecuteNoneQuery($iquery2);
$dsql->ExecuteNoneQuery(“Update `dede_taglist` set `arcrank` = 0 where aid=’$id’”);

经常上面的修改, 再重新生成页面. 就能自动审核”未审核稿件”. 全部都自动化了. 当然还可以设置栏目, 限定自动审核的范围,这就看具体的需求了.