Home > Article > Backend Development > Notes on using Smarty in PHP and several ways to access variables_PHP Tutorial
$tpl=new Smarty();//Create a smarty object. I am using Smarty-3.1.6 version
1. Set the smarty template path $tpl->setTemplateDir(); The default is templates
2. Set smarty template compilation path $tpl->setCompileDir(); The default is templates_c
3. Set the left and right separators of smarty template engine,
$tpl->left_delimiter="<{";
$tpl->right_delimiter="}>";
By default: public $left_delimiter = "{";//smarty source code
public $right_delimiter = "}";//smarty source code
Why do we need to change these separators?
Because for example, in earlier versions of smarty engine templates, errors will be reported and cannot be automatically recognized.
For example:
or in javascript