<?php

@set_time_limit(0);
define('WEB_ROOT', dirname(dirname(dirname(__FILE__))));
//Tmac物理根目录
define('TMAC_BASE_PATH', WEB_ROOT . DIRECTORY_SEPARATOR);
define('THISROOT', dirname(__file__));
define('APPLICATION', 'application');
//The directory in which your var are located.
define('VARROOT', 'var');
//定义项目名称和路径
define('APP_NAME', 'www');
//application目录
define('APPLICATION_ROOT', TMAC_BASE_PATH . APP_NAME . DIRECTORY_SEPARATOR . APPLICATION . DIRECTORY_SEPARATOR);
//var目录
define('VAR_ROOT', TMAC_BASE_PATH . APP_NAME . DIRECTORY_SEPARATOR . VARROOT . DIRECTORY_SEPARATOR);
require_once(WEB_ROOT . '/inc/common.inc.php');

//生成数据库操作实例
$db = new DB($dbinfo['hostname'], $dbinfo['username'], $dbinfo['password'], $dbinfo['database'], $dbinfo['char_set'], DB_PREFIX);
unset($dbinfo['hostname'], $dbinfo['username'], $dbinfo['password'], $dbinfo['database'], $dbinfo['char_set']);

//下面的可以放在要用的目录里 比如special/common 里设置
$options = array(
    'template_dir' => THISROOT . DIRECTORY_SEPARATOR . 'template', //设置模板目录
    'cache_dir' => THISROOT . DIRECTORY_SEPARATOR .'cache', //指定缓存文件存放目录
    'auto_update' => true, //当模板文件有改动时重新生成缓存 [关闭该项会快一些]
    'cache_lifetime' => 0, //缓存生命周期(分钟)，为 0 表示永久 [设置为 0 会快一些]
    'suffix' => '.html',
    'cache_open' => false //是否开启缓存，程序调试时使用
);
$template = template::getInstance(); //使用单件模式实例化模板类
$template->setOptions($options); //设置模板参数

$index_url = 'http://' . $_SERVER['SERVER_NAME'] . '/';
?>