Php-smarty-2 (+), phpsmarty-219
1. Delimiter
L Left_delimiter
L Right_delimiter
Smarty Default delimiter is: "{", "}"
If you need to change, you can set the above two properties
Template code:
Program code:
1. Template variable Assignment
Assign method two parameters
1) Template variable name
2) value
First, path settings
1. Several common paths in Smarty
1) Template path Template_dir
2) Compile Path Compile_dir
3) configuration file path Config_dir
4) cache file path Cache_dir
The above four paths are four properties under the Smarty class
2, in Smarty2.6, these properties can be set outside the class
Class smarty{
Var $template _dir;
Var $compile _dir;
Var $config _dir;
Var $cache _dir;
}
3. In Smarty3.0, this attribute is defined as:
protected $template _dir
protected $compile _dir
This is defined as a protected member, that is, we can inherit the Smarty class, and then we can have the few protected members.
Here, we find that these protected members can be set directly.
When assigning a value to a member that does not exist or is not accessible, the set is automatically executed
Automatically executes a get when a member that does not exist or is not accessible is evaluated
When a value or assignment is taken, the first check is whether the $allowed array in the method defines the element, and if it is defined, calls the Smarty method corresponding to the array element directly
Through the above code, you can be informed that in smarty3.0, there are eight methods specifically for these four attributes value and assignment
L Settemplatedir ()
L Setcompiledir ()
L Setconfigdir ()
L Setcachedir ()
L Gettemplatedir ()
L Getcompiledir ()
L Getconfigdir ()
L Getcachedir ()
We recommend that you use the above method for path setting
In the construction method of smarty, the default values are set for the above four properties.
Output Smarty Default path through the above program
http://www.bkjia.com/PHPjc/993274.html www.bkjia.com true http://www.bkjia.com/PHPjc/993274.html techarticle php-smarty-2, phpsmarty-219 1, delimiter l left_delimiter L right_delimiter Smarty The default delimiter is: {,} If you need to change, you can set the above two property template generation ... /c5>