Files
smarty/docs/pt_BR/designers/language-custom-functions/language-function-eval.xml

121 lines
3.6 KiB
XML
Raw Normal View History

2004-04-13 08:46:28 +00:00
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
2004-10-02 12:49:29 +00:00
<!-- EN-Revision: 1.2 Maintainer: thomasgm Status: ready -->
2004-04-13 08:46:28 +00:00
<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<EFBFBD>rio</entry>
2004-04-13 08:46:28 +00:00
<entry>Padr<EFBFBD>o</entry>
<entry>Descri<EFBFBD><EFBFBD>o</entry>
</row>
</thead>
<tbody>
<row>
<entry>var</entry>
<entry>mixed</entry>
<entry>Sim</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>Vari<EFBFBD>vel (ou string) para avaliar</entry>
</row>
<row>
<entry>assign</entry>
<entry>string</entry>
<entry>N<EFBFBD>o</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>A vari<72>vel de template que
receber<65> a sa<73>da</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
eval <20> usado para avaliar uma vari<72>vel como template. Isto pode ser usado para
coisas como embutir tags/vari<72>veis de template dentro de vari<72>veis
ou tags/vari<72>veis dentro de vari<72>veis em um arquivo de configura<72><61>o.
</para>
<para>
Se voc<6F> indicar o atributo especial "assign", a sa<73>da da fun<75><6E>o
eval ir<69> para esta vari<72>vel de template ao
inv<6E>s de aparecer no template.
</para>
<note>
<title>Nota T<>cnica</title>
<para>
Vari<72>veis avaliadas s<>o tratadas igual a templates. Elas seguem
o mesmo funcionamento para escapar e para seguran<61>a como
se fossem templates.
</para>
</note>
<note>
<title>Nota T<>cnica</title>
<para>
Vari<72>veis avaliadas s<>o compiladas a cada invoca<63><61>o, as vers<72>es
compiladas n<>o s<>o salvas. Entretando, se voc<6F> tiver o cache ativado,
a sa<73>da vai ficar no cache junto com o resto do template.
</para>
</note>
<example>
<title>eval</title>
<programlisting>
<![CDATA[
2004-04-13 08:46:28 +00:00
setup.conf
----------
emphstart = <b>
emphend = </b>
2004-04-13 08:46:28 +00:00
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>.
]]>
2004-04-13 08:46:28 +00:00
</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
-->