{$smarty} reserved variable
The PHP reserved {$smarty} variable can be used to access several
- special template variables. The full list of them follows.
+ enviroment and request variables. The full list of them follows.
Request variables
@@ -49,17 +49,24 @@
directly, although {$smarty.server.SCRIPT_NAME} is the
proposed way to access this value.
+
+click me
+click me
+]]>
+{$smarty.now}
The current timestamp
- can be accessed with {$smarty.now}. The number reflects the number of
+ can be accessed with {$smarty.now}. The value reflects the number of
seconds passed since the so-called Epoch (January 1, 1970)
and can be passed directly to the
date_format
- modifier for display purposes.
+ modifier for display purposes. Note that time() is called each invocation.
+ ie a script that takes 3 seconds to execute with $smarty.now at start and end will show the 3 seconds difference.
using {$smarty.now}
@@ -78,21 +85,26 @@
linkend="smarty.constants">smarty constants
- using {$smarty.const}
-
+ using {$smarty.const} to access constants
+
+
+
+
-
+{$smarty.capture}
- The output captured via {capture}..{/capture}
- construct can be accessed using {$smarty} variable. See section on
+ construct can be accessed using the {$smarty.capture} variable. See the section on
{capture} for an
example.
@@ -115,28 +127,51 @@
{$smarty} variable can be used to refer to
{section} and
{foreach}
- loop properties.
+ loop properties. These has very useful values such as .first .index etc
{$smarty.template}
- This variable contains the name of the current template being
- processed.
+ Returns the name of the current template being
+ processed. This example shows the container.tpl and the included banner.tpl
+ with {$smarty.template} within both
+
+Main container is {$smarty.template}
+{include file='banner.tpl}
+]]>
+
+will output
+
+Main page if container.tpl
+banner.tpl
+]]>
+
+
+
{$smarty.version}
- This variable contains the version of Smarty the template was compiled with.
+ Returns the version of Smarty the template was compiled with.
+
+Powered by Smarty {$smarty.version}
+]]>
+
+
+
{$smarty.ldelim}, {$smarty.rdelim}
- This variable is used for printing the left-delimiter and right-delimiter value literally.
- See {ldelim},{rdelim}.
+ These variables are used for printing the left-delimiter and right-delimiter value literally,
+ the same as {ldelim},{rdelim}.
See also