SetQuery($ sql);}" and save it."/> SetQuery($ sql);}" and save it.">

Home  >  Article  >  CMS Tutorial  >  How does DreamWeaver realize the automatic update homepage function?

How does DreamWeaver realize the automatic update homepage function?

藏色散人
藏色散人Original
2020-01-08 09:46:113156browse

How does DreamWeaver realize the automatic update homepage function?

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

推荐学习:织梦cms

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

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

The above is the detailed content of How does DreamWeaver realize the automatic update homepage function?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn