对于dedecms生成静态html的文件分析

<?php
/**

//判断是否安装成功
//如果这个按装配置文件
if(!file_exists(dirname(FILE).’/data/common.inc.php’)){
//echo dirname(FILE); D:\phpstudy_pro\WWW\www.dede.com
//跳转到 按装文件
header(‘Location:install/index.php’);
exit();
}

//自动生成HTML版
//如果缓存文件不存在,并且首页的静态文件不存在
if(isset($_GET[‘upcache’]) || !file_exists(‘index.html’))
{
//引入全局配置文件
require_once (dirname(FILE) . "/include/common.inc.php");
//引入视图模板
require_once DEDEINC."/arc.partview.class.php";
//引用全局作用域中可用的全部变量 为index.
$GLOBALS[‘_arclistEnv’] = ‘index’;
//查询数据库,获得首页模板1行内容
$row = $dsql->GetOne("Select * From #@__homepageset");
//模板变量 = 模板目录规则替换函数MfTemplet 替换这个模板内容
$row[‘templet’] = MfTemplet($row[‘templet’]);
//实例化视图类
$pv = new PartView();
//设置要解析的模板 SetTemplet(模板,设置类型)
$pv->SetTemplet($cfg_basedir . $cfg_templets_dir . "/" . $row[‘templet’]);
//如果为1
$row[‘showmod’] = isset($row[‘showmod’])? $row[‘showmod’] : 0;
if ($row[‘showmod’] == 1)
{
//保存结果为文件
$pv->SaveToHtml(dirname(FILE).’/index.html’);
//引入这个文件名
include(dirname(FILE).’/index.html’);
exit();
} else {
//显示模板
$pv->Display();
exit();
}
}
else
{
//打开静态页面
header(‘HTTP/1.1 301 Moved Permanently’);
header(‘Location:index.html’);
}
?>

发表评论