1.配置
class phpSmarty extends Smarty{
function __construct(){
parent::__construct();
$this->template_dir = 'templates/';
$this->compile_dir = 'templates_c/';
$this->config_dir = 'configs/';
$this->cache_dir = 'cache/';
//$this->caching=true;
$this->assign('app_name','phpSmarty');
$this->debugging = true;
}
}
$smarty=new phpSmarty();
$smarty->assign('name','ned');
$smarty->display('index.tpl');
----index.tpl---
Hello, {$name}!
2.注释
{* *}
3.变量