Smarty Template engine profile data and retention data, smarty templates
The examples in this article describe the configuration file data and methods of preserving data for the Smarty template engine. Share to everyone for your reference. Specific as follows:
How to get the template to remove data directly from the configuration file
1. Use Cases
When a variable value is not expected to be directly written to the program (allocated via Smarty), it can be obtained through the configuration file.
2. Write the configuration file
New folder: Config
New file name: My.ini or My.config
Content: Key=value;
Example:
Title= "This is the title of the website." Bgcolor= "Pink"
3. How to use
Load configuration file: {config_laod file= "path"}
Using configuration file data: <{#键 #}>
Example:
{config_laod file= "My.config"} ...
Second, how to obtain the data of the reserved variable
That is, how to obtain get/post/session/server data. The data is stored in an array, and Smarty encapsulates the method, which can be obtained directly from the Smarty variable.
1. Get the Get Data
Traditional way: Obtain get data first, then assign to Smarty. But the smarty itself encapsulates the method, without assigning it, to get the get data directly.
Here's how to use it:
User name: <{$smarty .get.username}>
Password: <{$smarty .get.password}>
2. Get Post Data
Here's how to use it:
User name: <{$smarty .post.username}>
Password: <{$smarty. post.password}>
3. Obtaining Server Data
Here's how to use it:
Server name: <{$smarty .server.server_name}>
I hope this article is helpful to everyone's PHP programming.
http://www.bkjia.com/PHPjc/976028.html www.bkjia.com true http://www.bkjia.com/PHPjc/976028.html techarticle smarty profile data and retention data for the template engine, Smarty template This article describes the configuration file data for the Smarty template engine and how to preserve the data. Share for everyone to join us ...