Home >Backend Development >PHP Tutorial >php—Smarty-6 (23), phpsmarty-623_PHP Tutorial
Continued from the previous article
10. html_options Print a set of options for select elements
{html_options values=$cust_ids selected=$customer_id output=$cust_names}
Values: array of values
Output: array of text
Selected: The value of the selected item
11. html_radios prints a set of radio buttons
Syntax:
{html_radios values=$cust_ids checked=$customer_id output=$cust_names separator="
"}
Values: array of values
Output: array of text
Separator: separator
Checked: the value in the option
3. Configuration file
Configuration files help designers manage template global variables in files. The simplest example is the template color variable. Generally, if you want to change the appearance color of a program, you must change the color variable of each file. If there is this configuration file, the color variables can be saved in one place, and you can update your colors by simply changing this configuration file.
Programming
1. Constants
SMARTY_DIR
2. Variables
l $template_dir: Template path
l $compile_dir : Compilation path
l $config_dir: Configuration file path
l $cache_dir: Cache file path
l $left_delimiter: left delimiter
l $right_delimiter: right delimiter
l $caching: Whether to enable caching
public $caching = false;
The cache is turned on and off by default. You can directly set it to true, enable the cache function
l $cache_lifetime: cache validity time (life cycle)
public $cache_lifetime = 3600;
The default is 3600 seconds,
l $debugging Open debugging window
There are two ways to open the debugging window:
1) In the template, use {debug}
2) In the program, use $smarty->debugging=true
Open in the program: you can see the variables assigned to the template
Open in template: variables assigned to the template, variables customized by the template
l $php_handling: In smarty2.6, if you want to use the {php} tag, the value of this option must be set to true