HI,欢迎来到我爱模板网!

织梦如何实现自动更新主页功能

织梦如何实现自动更新主页功能

织梦如何实现自动更新主页功能?

推荐学习:织梦cms

织梦DEDECMS实现自动更新主页功能

<?php 
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'"); 
} 
?>

给TA打赏
共{{data.count}}人
人已打赏
DEDECMS教程

织梦cms是什么数据库

2024-4-27 10:30:22

DEDECMS教程

织梦DEDECMS搜索页支持dede标签调用怎么修改

2024-4-27 11:26:07

【腾讯云】11.11云上盛惠!云服务器首年1.8折起,买1年送3个月!
11.11云上盛惠!海量产品·轻松上云!云服务器首年1.8折起,买1年送3个月!超值优惠,性能稳定,让您的云端之旅更加畅享。
查看更多相关信息>>
站长

(工作日 10:00 - 22:30 为您服务)

2026-01-30 02:49:29

您好,无论是售前、售后、意见建议……均可通过联系工单与我们取得联系。

猜你想问:

  • 购买的模板免费包安装吗?

  • 这个演示地址有吗?

  • 购买vip会员可以下载哪些模板?

您的留言我们已经收到,我们将会尽快跟您联系!
取消
立即选择任一渠道联系我们