: This article mainly introduces the php-Smarty-6 (23), for PHP tutorials interested in students can refer to it. Next
10. html_options prints a set of options for select elements.
{Html_options values = $ cust_ids selected = $ customer_id output = $ cust_names}
Text
Values: array of Values
Output: text array
Selected: the value of the Selected item.
11. print a group of radio buttons for html_radios.
Syntax:
{Html_radios values = $ cust_ids checked = $ customer_id output = $ cust_names separator ="
"}
Values: array of Values
Output: text array
Separator: Separator
Checked: value in the option
3. configuration file
The configuration file helps the designer manage template global variables in the file. The simplest example is the template color variable. Generally, if you want to change the color of a program, you must change the color variable of each file. If you have this configuration file, the color variable can be saved in one place. you only need to change this configuration file to update your color.
Configuration File:
In the above question, bgcolor in config1 has the same name as global bgcolor, and the local bgcolor is used as the standard.
The fgcolor variable does not exist in Config1, so the value of the global fgcolor variable is executed.
Program Design
I. constants
SMARTY_DIR
II. 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 separator
L $ right_delimiter: right separator
L $ caching: whether to enable cache
Public $ caching = false;
By default, the cache is enabled and closed. you can set it to true to enable the cache function.
L $ cache_lifetime: cache validity period (lifecycle)
Public $ cache_lifetime = 3600;
The default value is 3600 seconds,
L $ debugging open the debugging window
There are two ways to enable the debugging window:
1) in the template, use {debug}
2) in the program, use $ smarty-> debugging = true
Enabled in the program: you can see the variables allocated to the template
Enable in Template: variables assigned to the template and custom variables of the template
L $ php_handling: in smarty2.6, to use the {php} flag, you must set the value of this option to true.
The above introduces the php-Smarty-6 (23), including the content of the aspect, hope to be interested in PHP Tutorial friends help.