Dedecms首页调用随机文章实现自动更新

元之本 学习织梦cms 2019-09-07 12:48:55 1274 0 SEO

***步调用随机文章:

织梦给出了随机文章调用的参数如下:

{dede:arclist sort=’rand’ titlelen=48 row=16}
<li><a href="[field:arcurl/]" title="[field:title/]" target="_blank">[field:title/]</a></li>
{/dede:arclist}

第二步设置定时自动更新文件:

  复制下面代码,粘贴到一个新文件中,命名为:autoindex.php,上传到ftp的plus文件夹中:

<?php function sp_input( $text ) { $text = trim( $text ); $text = htmlspecialchars( $text ); if (!get_magic_quotes_gpc()) return addslashes( $text ); else return $text; } $autotime = 3600;//自动更新时间,单位为秒,这里我设为一小时,大家可以自行更改。 $fpath = "../data/last_time.inc";//记录更新时间文件,如果不能达到目的,请检查是否有读取权限。 include( $fpath ); if( empty($last_time)) $last_time = 0; if( sp_input($_GET['renew'])=="now") $last_time = 0; if((time()-$last_time)>=$autotime ) { define('DEDEADMIN', ereg_replace("[/\\]{1,}",'/',dirname(__FILE__) ) ); require_once
打赏 支付宝打赏 微信打赏

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。

本文链接:http://www.yuyubebe.cn/2019/09/339/

发表评论

评论列表(0人评论 , 1274人围观)
☹还没有评论,来说两句吧...
«    2023年4月    »
12
3456789
10111213141516
17181920212223
24252627282930
宝塔服务器面板,一键全能部署及管理,送你3188元礼包,点我领取