More formatting and cleaning up examples

This commit is contained in:
pete_morgan
2006-09-26 02:02:55 +00:00
parent 1698b7a1e5
commit 0f7046d4d6
18 changed files with 655 additions and 613 deletions

View File

@@ -3,16 +3,16 @@
<sect1 id="language.function.eval">
<title>{eval}</title>
<para>
{eval} is used to evaluate a variable as a template. This can be used
for things like embedding template tags/variables into variables or
tags/variables into config file variables.
<varname>{eval}</varname> is used to evaluate a variable as a template.
This can be used for things like embedding template tags/variables into
variables or tags/variables into config file variables.
</para>
<para>
If you supply the special "assign" attribute, the output of the
{eval} function will be assigned to this template variable instead of
being output to the template.
If you supply the <parameter>assign</parameter> attribute, the output of the
<varname>{eval}</varname> function will be assigned to this template
variable instead of being output to the template.
</para>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" align="center" />
@@ -35,14 +35,14 @@
<entry>mixed</entry>
<entry>Yes</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>variable (or string) to evaluate</entry>
<entry>Variable (or string) to evaluate</entry>
</row>
<row>
<entry>assign</entry>
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>the template variable the output will be assigned
<entry>The template variable the output will be assigned
to</entry>
</row>
</tbody>
@@ -52,28 +52,28 @@
<note>
<title>Technical Note</title>
<para>
<itemizedlist>
<listitem><para>
Evaluated variables are treated the same as templates. They follow
the same escapement and security features just as if they were
templates.
</para>
</note>
<note>
<title>Technical Note</title>
<para>
</para></listitem>
<listitem><para>
Evaluated variables are compiled on every invocation, the compiled
versions are not saved! However if you have
<link linkend="caching">caching</link>
enabled, the
<link linkend="caching">caching</link> enabled, the
output will be cached with the rest of the template.
</para></listitem>
</itemizedlist>
</para>
</note>
<example>
<title>{eval}</title>
<para>The contents of the config file, <filename>setup.conf</filename>.</para>
<programlisting>
<![CDATA[
#setup.conf
#----------
emphstart = <strong>
emphend = </strong>
title = Welcome to {$company}'s home page!
@@ -96,7 +96,7 @@ ErrorState = You must supply a {#emphstart#}state{#emphend#}.
]]>
</programlisting>
<para>
The above example will output:
The above template will output:
</para>
<screen>
<![CDATA[
@@ -107,17 +107,18 @@ You must supply a <strong>state</strong>.
]]>
</screen>
</example>
<example>
<title>another {eval} example</title>
<para>This outputs the server name (in uppercase) and IP.
The variable $str could be from a database query also.</para>
<title>Another {eval} example</title>
<para>This outputs the server name (in uppercase) and IP. The assigned
variable <parameter>$str</parameter> could be from a database query.</para>
<programlisting role="php">
<![CDATA[
// php script
<?php
$str = 'The server name is {$smarty.server.SERVER_NAME|upper} '
.'at {$smarty.server.SERVER_ADDR}';
$smarty->assign('foo',$str);
?>
]]>
</programlisting>
<para>
@@ -129,8 +130,8 @@ $smarty->assign('foo',$str);
]]>
</programlisting>
</example>
</sect1>
<!-- Keep this comment at the end of the file
Local variables: