两步实现网站首页的自动生成

第一步:

删除根目录下的index.php 建立一个 idx.php 内容如下

<?php
require('common/incfiles/common.inc.php');
require('common/incfiles/config.inc.php');
require('common/incfiles/module_config.inc.php');
header("cache-control: no-cache, must-revalidate");
header("pragma: no-cache");

$tappstr = 'index_update_date';
if (ii_cache_is($tappstr)) $GLOBALS[$tappstr] = ii_cache_get($tappstr, 0);
else
{
  ii_cache_put($tappstr, 0, ii_now());
  $GLOBALS[$tappstr] = ii_now();
}
if (ii_datediff('n', $GLOBALS[$tappstr], ii_now()) > 20)
{
  ii_cache_put($tappstr, 0, ii_now());
  file_put_contents('index.html', jtbc_cms_module());
}
?>

第二步:

在后台的系统管理/模板管理/首页模板中加入如下代码,加入之后在系统管理/缓存管理中删除缓存

<script type="text/javascript">igets("idx.php", nll);</script>

自动生成首页的功能就完成了,需要先生成一个index.html,可以先手动执行 idx.php