Home  >  Article  >  Backend Development  >  php—Smarty-6 (23)

php—Smarty-6 (23)

WBOY
WBOYOriginal
2016-08-08 09:24:48956browse

Continued from the previous article

10, html_options Print a set of options for select elements

Values: Array of values

Output: Array of text

Selected: The value of the selected item

11, html_radios Print a set of radio buttons

Grammar:

{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.

Profile:

In the above question, the bgcolor in config1 has the same name as the global bgcolor, and the local bgcolor is used as the standard

There is no fgcolor variable in Config1, so the value of the global fgcolor variable is executed

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 to enable the cache function

l $cache_lifetime: cache validity time (life cycle)

public $cache_lifetime = 3600;

The default is 3600 seconds,

l $debugging Open the 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, you must set the value of this option to true

The above introduces php-Smarty-6 (23), including the relevant content. I hope it will be helpful to friends who are interested in PHP tutorials.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:php—Smarty-7(24)Next article:php—Smarty-7(24)