猪猪编程:Smarty升级到3.1
(2014-10-13 13:45:23)
标签:
股票 |
分类: 计算机 |
2014-10-13 周一
WEB服务器升级了一下smarty,利用它生成php的静态页面,避免频繁操作数据库的费事。升级后,和老版比较,一些方法改变了。
require('./include/Smarty.class.php');
$smarty = new Smarty;
$smarty->template_dir='./include/templates';
$smarty->config_dir='./include/configs';
$smarty->cache_dir='./include/cache';
$smarty->compile_dir='./include/templates_c';
$smarty->cache_lifetime = 60*60*24*7;
$smarty->caching = true;
if(!$smarty->isCached('newbook.tpl'))
{
读取数据库
}
$smarty->display('newbook.tpl');