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();
    }

    ?>

    注:网上转载的,自己没用到,没做测试,如果测试成功请告知,谢谢!
  • 相关阅读:
    MySQL5.6升级5.7步骤
    PG数据库学习随笔(1)
    MySQL 8017+版本的clone-plugin 应用
    AWS多元复制到EC2机器
    AWS告警优化
    mongo微服务搭建
    py执行数据库存储过程
    mysql temporary table表一个机智用法:
    记录ddl操作
    sql改写
  • 原文地址:https://www.cnblogs.com/Byrd/p/2161660.html
Copyright © 2011-2022 走看看