首页 > 代码库 > Smarty模版

Smarty模版

smarty.inc.php

<?php

//创建一个实际路径
define(‘ROOT_PATH‘,dirname(__FILE__));
//引入Smarty
require ROOT_PATH.‘/smarty/Smarty.class.php‘;

//创建一个Smarty对象
$_smarty = new Smarty();

//模板目录
$_smarty->template_dir = ROOT_PATH.‘/templates/‘;
//编译目录
$_smarty->compile_dir = ROOT_PATH.‘/templates_c/‘;
//配置变量目录
$_smarty->config_dir = ROOT_PATH.‘/configs/‘;
//缓存目录
$_smarty->cache_dir = ROOT_PATH.‘/cache/‘;
//是否开启缓存,网站开发调试阶段,我们应该关闭缓存
$_smarty->caching = 1;
//缓存的声明周期
$_smarty->cache_lifetime = 60*60*24;
//左定界符
$_smarty->left_delimiter = ‘{‘;
//右定界符
$_smarty->right_delimiter = ‘}‘;
?>