Smarty reserved variable Usage Analysis, smarty variable usage
This example describes how to use the Smarty reserved variable. We will share this with you for your reference. The details are as follows:
The {$ smarty} variable does not need to be assigned. It can be directly used in the template to access some special template variables. There are many variables, such as: Page request variables $ _ GET, $ _ POST, $ _ REQUEST, $ _ SESSION, $ _ COOKIE, and some other environment variables, such as $ _ ENV and $ _ SERVER, can be obtained directly using the following methods:
{$smarty.get}
GET url parameters with $ _ GET
For example, $ _ GET ['page'] is obtained through {$ smarty. get. page }.
{$smarty.post}
Same as $ _ POST for obtaining Parameters
{$smarty.request}
Same as $ _ REQUEST for REQUEST Parameters
{$smarty.cookie}
Get COOKIE with $ _ cookie
{$smarty.session}
Get the SESSION with $ _ session
{$smarty.server}
Get SERVER variables with $ _ SERVER
{$smarty.env}
Get environment variables with $ _ ENV
{$smarty.now}
Same as time (), get Timestamp
{$smarty.const}
Directly access PHP constants, such as {$ smarty. const. _ FILE __}
{$smarty.capture}
The template output captured by the built-in {capture}... {/capture} function can be accessed by {$ smarty. capture. name }.
{$smarty.section} {$smarty.foreach}
Used to access the cyclic attributes of {section} and {foreach} respectively. Some attribute values such as first, last, and index are available.
{$smarty.template}
Returns the name of the current template.
{$smarty.version}
Smarty version
{$smarty.ldelim} {$smarty.rdelim}
Used to print the left separator and right separator, class {ldelim} {rdelim}