zoukankan      html  css  js  c++  java
  • DEDECMS自动更新首页HTML的方法(转)

    DEDECMS自动更新首页HTML的方法如下:

    1、在首页模板<head>区里插入如下代码后,手动生成一次首页HTML,以后就会根据你设定的时间自动更新了。

    <script src="/plus/auto_makehtml_homepage.php" language="javascript"></script>

    2、把以下代码保存为 auto_makehtml_homepage.php ,放到 /plus/ 下。

    <?php
    require_once(dirname(__FILE__)."/../include/config_base.php");
    require_once(dirname(__FILE__)."/../include/inc_arcpart_view.php");
    $lasttime=filemtime(dirname(__FILE__)."/../index.html");
    $interval=3600;//3600秒,测试时可改小点如60,方便查看效果。
    if((time()-$lasttime)>$interval)
    {
     $dsql = new DedeSql(false);
     $row  = $dsql->GetOne("Select * From #@__homepageset");
     $dsql->Close();
     $templet=$row['templet'];
     $position=$row['position'];
     $homeFile = dirname(__FILE__)."/".$position;
     $homeFile = str_replace("\\","/",$homeFile);
     $homeFile = str_replace("//","/",$homeFile);
     $templet = str_replace("{style}",$cfg_df_style,$templet);
     $pv = new PartView();
     $pv->SetTemplet($cfg_basedir.$cfg_templets_dir."/".$templet);
     $pv->SaveToHtml($homeFile);
     $pv->Close();
    }

    ?>

    注:网上转载的,自己没用到,没做测试,如果测试成功请告知,谢谢!
  • 相关阅读:
    条件注释判断浏览器版本<!--[if lt IE 9]>
    动态加载js、css 代码
    C趣味题目
    shell脚本
    Logiscope学习网址
    将double型小数点后面多余的零去掉
    qt和makefile学习网址
    微软推出的工作流引擎
    java例子
    js 定义hash类
  • 原文地址:https://www.cnblogs.com/Byrd/p/2161660.html
Copyright © 2011-2022 走看看