The examples in this article describe the use of smarty retention variables. Share to everyone for your reference, specific as follows:
{$smarty} variable does not need to be allocated, it can be directly in the template, used to access some special template variables, there are many variables, such as: page request variable $_get,$_post,$_request,$_session,$_cookie, there are some such as environment variable $ _env,$_server, they can be obtained directly from the following ways:
Get URL parameters with $_get
For example: $_get[' page ' gets through {$smarty. Get.page}
Get Parameters with $_post
Get request parameters with $_request
Get Cookies with $_cookie
Get session with $_session
Get Server variables with $_server
Get environment variables with $_env
Same time (), get timestamp
Direct access to PHP constants such as {$smarty. const.__file__}
Through the built-in {capture} ... The template output captured by the {/capture} function can be accessed by {$smarty. Capture.name}
{$smarty. Section} {$smarty. foreach}
Used to access the loop properties of {section} and {foreach} respectively, some First,last,index property values are available
Returns the name of the current template
Smarty version
{$smarty. Ldelim} {$smarty. Rdelim}
Used to print left and right delimiters, class {Ldelim}{rdelim}
More interested in smarty related content readers can view the site topics: "Smarty Template Primer Tutorial", "PHP Template Technology Summary", "PHP based on PDO Operation Database Skills summary", "PHP Operations and Operator Usage Summary", "PHP Network Programming Skills Summary", " Introduction to PHP Basic Grammar, "Introduction to PHP object-oriented programming", "PHP string (String) Usage Summary", "Php+mysql Database Operations Tutorial" and "PHP common database Operation Skills Summary"
I hope this article will help you with the PHP program design based on Smarty template.