added "eval" plugin docs

This commit is contained in:
mohrt
2002-02-27 19:14:09 +00:00
parent d2e04b7161
commit 04e2df799d
2 changed files with 74 additions and 0 deletions

1
NEWS
View File

@@ -1,5 +1,6 @@
Version 2.0 Version 2.0
----------- -----------
- added "eval" plugin for evaluating variables as templates (Monte)
- removed $tpl_file_ext class variable, no longer used. (Monte) - removed $tpl_file_ext class variable, no longer used. (Monte)
- added "hex" and "hexentity" escape types to escape modifier. (Monte) - added "hex" and "hexentity" escape types to escape modifier. (Monte)
- removed dependency on PEAR. (Andrei) - removed dependency on PEAR. (Andrei)

View File

@@ -2723,6 +2723,79 @@ OUTPUT:
4<br> 4<br>
6<br> 6<br>
8&lt;br&gt;</programlisting> 8&lt;br&gt;</programlisting>
</example>
</sect3>
<sect3 id="language.function.eval">
<title>eval</title>
<informaltable frame=all>
<tgroup cols=5>
<colspec colname=param align=center>
<colspec colname=type align=center>
<colspec colname=required align=center>
<colspec colname=default align=center>
<colspec colname=desc>
<thead>
<row>
<entry>Attribute Name</entry>
<entry>Type</entry>
<entry>Required</entry>
<entry>Default</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>var</entry>
<entry>mixed</entry>
<entry>Yes</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>variable (or string) to evaluate</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<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.
</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.
</para>
<example>
<title>eval</title>
<programlisting>
setup.conf
----------
emphstart = &lt;b&gt;
emphend = &lt;/b&gt;
title = Welcome to {$company}'s home page!
ErrorCity = You must supply a {#emphstart#}city{#emphend#}.
ErrorState = You must supply a {#emphstart#}state{#emphend#}.
index.tpl
---------
{config_load file="setup.conf"}
{eval var=$foo}
{eval var=#title#}
{eval var=#ErrorCity#}
{eval var=#ErrorState# assign="state_error"}
{$state_error}
OUTPUT:
This is the contents of foo.
Welcome to Foobar Pub &amp; Grill's home page!
You must supply a &lt;b&gt;city&lt;/b&gt;.
You must supply a &lt;b&gt;state&lt;/b&gt;.
</programlisting>
</example> </example>
</sect3> </sect3>
<sect3 id="language.function.fetch"> <sect3 id="language.function.fetch">