2004-10-07 18:50:52 +00:00
|
|
|
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
|
|
|
|
<!-- $Revision$ -->
|
|
|
|
|
|
<sect1 id="language.function.eval">
|
2005-11-08 23:37:29 +00:00
|
|
|
|
<title>{eval}</title>
|
2004-10-07 18:50:52 +00:00
|
|
|
|
<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>Nombre del Atributo</entry>
|
|
|
|
|
|
<entry>Tipo</entry>
|
|
|
|
|
|
<entry>Requerido</entry>
|
|
|
|
|
|
<entry>Default</entry>
|
|
|
|
|
|
<entry>Descripci<EFBFBD>n</entry>
|
|
|
|
|
|
</row>
|
|
|
|
|
|
</thead>
|
|
|
|
|
|
<tbody>
|
|
|
|
|
|
<row>
|
|
|
|
|
|
<entry>var</entry>
|
|
|
|
|
|
<entry>mixed</entry>
|
|
|
|
|
|
<entry>Si</entry>
|
|
|
|
|
|
<entry><emphasis>n/a</emphasis></entry>
|
|
|
|
|
|
<entry>variable (o cadena) para evaluar</entry>
|
|
|
|
|
|
</row>
|
|
|
|
|
|
<row>
|
|
|
|
|
|
<entry>assign</entry>
|
|
|
|
|
|
<entry>string</entry>
|
|
|
|
|
|
<entry>No</entry>
|
|
|
|
|
|
<entry><emphasis>n/a</emphasis></entry>
|
|
|
|
|
|
<entry>La variable del template que recibir<69> la salida</entry>
|
|
|
|
|
|
</row>
|
|
|
|
|
|
</tbody>
|
|
|
|
|
|
</tgroup>
|
|
|
|
|
|
</informaltable>
|
|
|
|
|
|
<para>
|
2005-11-08 23:37:29 +00:00
|
|
|
|
{eval} es usado para evaluar una variable como de template. Esto puede
|
2004-10-07 18:50:52 +00:00
|
|
|
|
ser usado para cosas como incrustar tags(etiquetas)/variables del
|
|
|
|
|
|
template dentro de las variables o tags(etiquetas)/variables dentro
|
|
|
|
|
|
de las variables de un archivo de configuraci<63>n.
|
|
|
|
|
|
</para>
|
|
|
|
|
|
<para>
|
|
|
|
|
|
Si usted indica el atributo especial "assign", la salida de la
|
|
|
|
|
|
funci<63>n eval se ira para esta variable de template en vez de
|
|
|
|
|
|
aparecer en el template.
|
|
|
|
|
|
</para>
|
|
|
|
|
|
<note>
|
|
|
|
|
|
<title>Nota T<>cnica</title>
|
|
|
|
|
|
<para>
|
|
|
|
|
|
Al evaluar las variables son tratas igual que el template.
|
|
|
|
|
|
Ellas sigen el mismo funcionamiento para escape y seguridad tal
|
|
|
|
|
|
como si ellas fueran templates.
|
|
|
|
|
|
</para>
|
|
|
|
|
|
</note>
|
|
|
|
|
|
<note>
|
|
|
|
|
|
<title>Nota T<>cnica</title>
|
|
|
|
|
|
<para>
|
|
|
|
|
|
Las variables evaluadas son compiladas en cada invocaci<63>n, las
|
|
|
|
|
|
vesiones compiladas no son salvas. Sin embargo, si usted tiene
|
2005-11-08 23:37:29 +00:00
|
|
|
|
activado el cache, la salida se va a fijar en la
|
|
|
|
|
|
<link linkend="caching">cache</link> junto con el resto del template.
|
2004-10-07 18:50:52 +00:00
|
|
|
|
</para>
|
|
|
|
|
|
</note>
|
|
|
|
|
|
<example>
|
2005-11-08 23:37:29 +00:00
|
|
|
|
<title>{eval}</title>
|
|
|
|
|
|
<programlisting>
|
|
|
|
|
|
<![CDATA[
|
|
|
|
|
|
setup.conf
|
|
|
|
|
|
----------
|
2004-10-07 18:50:52 +00:00
|
|
|
|
|
2005-11-08 23:37:29 +00:00
|
|
|
|
emphstart = <strong>
|
|
|
|
|
|
emphend = </strong>
|
|
|
|
|
|
title = Welcome to {$company}'s home page!
|
|
|
|
|
|
ErrorCity = You must supply a {#emphstart#}city{#emphend#}.
|
|
|
|
|
|
ErrorState = You must supply a {#emphstart#}state{#emphend#}.
|
|
|
|
|
|
]]>
|
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
<para>
|
|
|
|
|
|
Where index.tpl is:
|
|
|
|
|
|
</para>
|
|
|
|
|
|
<programlisting>
|
|
|
|
|
|
<![CDATA[
|
|
|
|
|
|
{config_load file="setup.conf"}
|
2004-10-07 18:50:52 +00:00
|
|
|
|
|
2005-11-08 23:37:29 +00:00
|
|
|
|
{eval var=$foo}
|
|
|
|
|
|
{eval var=#title#}
|
|
|
|
|
|
{eval var=#ErrorCity#}
|
|
|
|
|
|
{eval var=#ErrorState# assign="state_error"}
|
|
|
|
|
|
{$state_error}
|
|
|
|
|
|
]]>
|
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
<para>
|
|
|
|
|
|
La salida del ejemplo de arriba:
|
|
|
|
|
|
</para>
|
|
|
|
|
|
<screen>
|
|
|
|
|
|
<![CDATA[
|
|
|
|
|
|
This is the contents of foo.
|
|
|
|
|
|
Welcome to Foobar Pub & Grill's home page!
|
|
|
|
|
|
You must supply a <strong>city</strong>.
|
|
|
|
|
|
You must supply a <strong>state</strong>.
|
2004-10-07 18:50:52 +00:00
|
|
|
|
|
2005-11-08 23:37:29 +00:00
|
|
|
|
]]>
|
|
|
|
|
|
</screen>
|
|
|
|
|
|
</example>
|
2004-10-07 18:50:52 +00:00
|
|
|
|
</sect1>
|
|
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
|
|
|
|
Local variables:
|
|
|
|
|
|
mode: sgml
|
|
|
|
|
|
sgml-omittag:t
|
|
|
|
|
|
sgml-shorttag:t
|
|
|
|
|
|
sgml-minimize-attributes:nil
|
|
|
|
|
|
sgml-always-quote-attributes:t
|
|
|
|
|
|
sgml-indent-step:1
|
|
|
|
|
|
sgml-indent-data:t
|
|
|
|
|
|
indent-tabs-mode:nil
|
|
|
|
|
|
sgml-parent-document:nil
|
|
|
|
|
|
sgml-default-dtd-file:"../../../../manual.ced"
|
|
|
|
|
|
sgml-exposed-tags:nil
|
|
|
|
|
|
sgml-local-catalogs:nil
|
|
|
|
|
|
sgml-local-ecat-files:nil
|
|
|
|
|
|
End:
|
|
|
|
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
|
|
|
|
vim: et tw=78 syn=sgml
|
|
|
|
|
|
vi: ts=1 sw=1
|
|
|
|
|
|
-->
|