PHPCMS V9 定时发布文章的实现方法


本文整理自网络,侵删。

在这里,CMSYOU与大家分享怎么让Phpcms V9自动发布文章,所谓Phpcms V9文章定时发布。

  在Wordpress中,添加博文的时候,发布日期写未来的时间,那么在时间到来的时候,文章会自动发布出现在首页,做到预约发布、自动发布。其实在Phpcms V9中同样可以做到定时发布,这样就可以预先设置些文章,在假期可以定时发布,避免出现类似CMSYOU在过年期间,更新文章停了1个月的时间。

  具体怎么做到Phpcms V9文章定时发布呢?这一方法来自PC论坛,具体方法如下。

  1、修改api/count.php这一文件,在PHP语句结束代码 ?>前,加入以下代码:


代码如下:
//add 定时发布审核功能
$urlobj = pc_base::load_app_class('url', 'content');
$html = pc_base::load_app_class('html', 'content');

$modelid = $modelid ? $modelid : intval($_GET['modelid']);
$content_db = $content_db ? $content_db : pc_base::load_model('content_model');
$content_db->set_model($modelid);
$where = ' status = 1 and inputtime <= '.SYS_TIME;
$r = $content_db->count($where);
if( !empty($r) ){ //执行update操作
$ids = $content_db->select($where, 'id,catid', $r, '', '', 'id');
foreach($ids AS $kid=>$v){
$catid = $v['catid'];
$id = $kid;
$r = $content_db->get_content($catid,$id);
$urls = $urlobj->show($id, 0, $catid, $r['inputtime'], $r['prefix'],$r,'add');
if($urls['content_ishtml']) $html->show($urls[1],$urls['data'],0);
$html->index();
$html->create_relation_html($catid);
}
$content_db->update( array('status'=>99),$where );
}

阅读剩余部分

相关阅读 >>

phpcms v9后台登陆模板修改方法和程序版本更新提示修改方法

phpcms v9过滤采集内容中css样式的实现方法

phpcms v9 添加二级导航的思路详解

phpcms图片频道模板制作

phpcms配置列表页以及获得文章发布时间

完美整合phpcms v9和discuz x3.1实现同步登陆退出论坛免激活

phpcms v9后台添加文章时选择相关文章可调用其它模型信息的方法

phpcms v9自带采集模块功能体验

phpcms点击图片进入下一页功能的实现方法

php模板原理讲解

更多相关阅读请进入《phpcms》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...