Updated description of {$smarty} variable.

This commit is contained in:
andrey
2002-02-19 20:53:29 +00:00
parent 5711d1597a
commit ccdaf93814

View File

@@ -1982,14 +1982,20 @@ email: zaphod@slartibartfast.com<br>
<sect2> <sect2>
<title>{$smarty} reserved variable</title> <title>{$smarty} reserved variable</title>
<para> <para>
You can access reserved variables in Smarty via the special The reserved {$smarty} variable can be used to access several
variable {$smarty}. You can access request variables such as get, special template variables. The full list of them follows.
post, cookies, server, env and session variables with the syntax in
the following examples.
</para> </para>
<para> <para>
The special variable {$smarty} was added to Smarty 1.4.4. The special variable {$smarty} was added to Smarty 1.4.4.
</para> </para>
<sect3>
<title>Request variables</title>
<para>
The request variables such as get, post, cookies, server,
environment, and session variables can be accessed as demonstrated
in the examples below:
</para>
<example> <example>
<title>displaying request variables</title> <title>displaying request variables</title>
@@ -2018,21 +2024,49 @@ email: zaphod@slartibartfast.com&lt;br&gt;
</programlisting> </programlisting>
</example> </example>
</sect3>
<sect3>
<title>Current timestamp</title>
<para> <para>
The current date can be displayed with {$smarty.now}. This is a unix The current timestamp can be accessed with {$smarty.now}. The
timestamp of the current date/time. number reflects the number of seconds passed since the so-called
Epoch (January 1, 1970) and can be passed directly to
date_format modifier for display purposes.
</para> </para>
<example> <example>
<title>displaying current date</title> <title>using {$smarty.now}</title>
<programlisting> <programlisting>
{* use the date_formate modifier to format the date *} {* use the date_format modifier to show current date and time *}
{$smarty.now|date_format:"%Y-%m-%d %H:%M:%S"} {$smarty.now|date_format:"%Y-%m-%d %H:%M:%S"}
</programlisting> </programlisting>
</example> </example>
</sect3>
<sect3>
<title>Output capture buffer</title>
<para>
The output captured via {capture}..{/capture} construct can be
accessed using {$smarty} variable. See section on
<link linkend="builtin.functions.capture">capture</link> for an example.
</para>
</sect3>
<sect3>
<title>Loop properties</title>
<para>
{$smarty} variable can be used to refer to 'section' and
'foreach' loop properties. See docs for
<link linkend="builtin.functions.section">section</link> and
<link linkend="builtin.function.foreach">foreach</link>.
</para>
</sect3>
</sect2> </sect2>
<sect2> <sect2>
<title>Functions</title> <title>Functions</title>
<para> <para>
@@ -3530,7 +3564,7 @@ $smarty->assign("contacts", array(array("phone" =&gt; "1", "fax" =&gt; "2", "cel
*} *}
{foreach name=outer item=contact from=$contacts} {foreach name=outer item=contact from=$contacts}
{foreach key=key item=item from=$smarty.foreach.outer} {foreach key=key item=item from=$contact}
{$key}: {$item}&lt;br&gt; {$key}: {$item}&lt;br&gt;
{/foreach} {/foreach}
{/foreach} {/foreach}