This paper mainly introduces the usage of smarty reserved variables, introduces the function and use method of Smarty common reserved variables in detail, and needs friends to refer to them. We hope to help you.
Specific as follows:
{$smarty} variables do not need to be assigned, it can be directly in the template, 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 in the following ways:
{$smarty. Get}
Get URL parameters with $_get
such as: $_get[' page '] through {$smarty. Get.page} Get
{$smarty. Post}
Get Parameters with $_post
{$smarty. Request}
Get request parameters with $_request
{$smarty. Cookies}
Get a cookie with $_cookie
{$smarty. Session}
Get session with $_session
{$smarty. Server}
Get Server variables with $_server
{$smarty. env}
Get environment variables with $_env
{$smarty. Now}
Same time (), get timestamp
{$smarty. Const}
Direct access to PHP constants, such as {$smarty. const.__file__}
{$smarty. Capture}
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}, and some First,last,index property values are available
{$smarty. Template}
Returns the current template name
{$smarty. Version}
Smarty version
{$smarty. Ldelim} {$smarty. Rdelim}
Used to print left and right delimiters, class {Ldelim}{rdelim}
Related recommendations:
CI Framework Integration Smarty Example detailed
An explanation of how the Smarty template engine caches
Smarty template engine Video teaching materials course recommendation