Files
smarty/docs/pt_BR/designers/language-custom-functions/language-function-eval.xml
nlopess f8014929e5 fix revision tags
@@arg0@
2004-10-03 09:04:23 +00:00

121 lines
3.6 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<!-- EN-Revision: 1.1 Maintainer: thomasgm Status: ready -->
<sect1 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>Nome do Atributo</entry>
<entry>Tipo</entry>
<entry>Obrigatório</entry>
<entry>Padrão</entry>
<entry>Descrição</entry>
</row>
</thead>
<tbody>
<row>
<entry>var</entry>
<entry>mixed</entry>
<entry>Sim</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>Variável (ou string) para avaliar</entry>
</row>
<row>
<entry>assign</entry>
<entry>string</entry>
<entry>Não</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>A variável de template que
receberá a saída</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
eval é usado para avaliar uma variável como template. Isto pode ser usado para
coisas como embutir tags/variáveis de template dentro de variáveis
ou tags/variáveis dentro de variáveis em um arquivo de configuração.
</para>
<para>
Se você indicar o atributo especial "assign", a saída da função
eval irá para esta variável de template ao
invés de aparecer no template.
</para>
<note>
<title>Nota Técnica</title>
<para>
Variáveis avaliadas são tratadas igual a templates. Elas seguem
o mesmo funcionamento para escapar e para segurança como
se fossem templates.
</para>
</note>
<note>
<title>Nota Técnica</title>
<para>
Variáveis avaliadas são compiladas a cada invocação, as versões
compiladas não são salvas. Entretando, se você tiver o cache ativado,
a saída vai ficar no cache junto com o resto do template.
</para>
</note>
<example>
<title>eval</title>
<programlisting>
<![CDATA[
setup.conf
----------
emphstart = <b>
emphend = </b>
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}
MOSTRA:
This is the contents of foo.
Welcome to Foobar Pub & Grill's home page!
You must supply a <b>city</b>.
You must supply a <b>state</b>.
]]>
</programlisting>
</example>
</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
-->