2004-10-07 18:50:52 +00:00
|
|
|
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
|
|
|
|
<!-- $Revision$ -->
|
|
|
|
|
|
<sect1 id="language.function.capture">
|
|
|
|
|
|
<title>capture</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>Nombre del Atributo</entry>
|
|
|
|
|
|
<entry>Tipo</entry>
|
|
|
|
|
|
<entry>Requerido</entry>
|
|
|
|
|
|
<entry>Default</entry>
|
|
|
|
|
|
<entry>Descripci<EFBFBD>n</entry>
|
|
|
|
|
|
</row>
|
|
|
|
|
|
</thead>
|
|
|
|
|
|
<tbody>
|
|
|
|
|
|
<row>
|
|
|
|
|
|
<entry>name</entry>
|
|
|
|
|
|
<entry>string</entry>
|
|
|
|
|
|
<entry>no</entry>
|
|
|
|
|
|
<entry><emphasis>default</emphasis></entry>
|
|
|
|
|
|
<entry>El nombre del bloque capturado</entry>
|
|
|
|
|
|
</row>
|
|
|
|
|
|
<row>
|
|
|
|
|
|
<entry>assign</entry>
|
|
|
|
|
|
<entry>string</entry>
|
|
|
|
|
|
<entry>No</entry>
|
|
|
|
|
|
<entry><emphasis>n/a</emphasis></entry>
|
|
|
|
|
|
<entry>El nombre de la variable para dar valor a la salida
|
|
|
|
|
|
capturada</entry>
|
|
|
|
|
|
</row>
|
|
|
|
|
|
</tbody>
|
|
|
|
|
|
</tgroup>
|
|
|
|
|
|
</informaltable>
|
|
|
|
|
|
<para>
|
2005-11-08 23:37:29 +00:00
|
|
|
|
{capture} es usado para recolectar toda la salida del template en una
|
2004-10-07 18:50:52 +00:00
|
|
|
|
variable en lugar de mostrarla.
|
|
|
|
|
|
Cualquier contenido entre {capture name="foo"} y {/capture} es
|
|
|
|
|
|
recoletado en una variable especificada y el atributo name. El
|
|
|
|
|
|
contenido capturado puede ser usado en el template a partir de la
|
2005-11-08 23:37:29 +00:00
|
|
|
|
variable especial
|
|
|
|
|
|
<link linkend="language.variables.smarty.capture">$smarty.capture.foo</link>
|
|
|
|
|
|
en donde foo es el valor
|
2004-10-07 18:50:52 +00:00
|
|
|
|
pasado para el atributo name. Si usted no pasa un atributo name,
|
|
|
|
|
|
entonces ser<65> usado "default". Todos lo comandos {capture} deben
|
|
|
|
|
|
estar entre {/capture}. Usted puede anidar(colocar uno dentro de
|
|
|
|
|
|
otro) comandos capture.
|
|
|
|
|
|
</para>
|
|
|
|
|
|
<note>
|
|
|
|
|
|
<title>Nota Tecnica</title>
|
|
|
|
|
|
<para>
|
|
|
|
|
|
Smarty 1.4.0 - 1.4.4 coloca el contenido capturado dentro de la
|
|
|
|
|
|
variable llamada $return. A partir de 1.4.5, este funcionamento fue
|
|
|
|
|
|
cambiado para usar el atributo name, entonces en consecuencia actualice
|
|
|
|
|
|
sus templates.
|
|
|
|
|
|
</para>
|
|
|
|
|
|
</note>
|
|
|
|
|
|
<caution>
|
|
|
|
|
|
<para>
|
|
|
|
|
|
Tenga cuidado cuando capture la salida del comando
|
2005-11-08 23:37:29 +00:00
|
|
|
|
<link linkend="language.function.insert">{insert}</link>.
|
|
|
|
|
|
Si tuviera activo el <link linkend="caching">cache</link> y tuviera
|
|
|
|
|
|
comandos <link linkend="language.function.insert">{insert}</link> y
|
|
|
|
|
|
usted espera que funcione con contenido de cache, no se capturara este contenido.
|
2004-10-07 18:50:52 +00:00
|
|
|
|
</para>
|
|
|
|
|
|
</caution>
|
|
|
|
|
|
<para>
|
|
|
|
|
|
<example>
|
|
|
|
|
|
<title>capturando contenido de template</title>
|
|
|
|
|
|
<programlisting>
|
|
|
|
|
|
<![CDATA[
|
|
|
|
|
|
{* no queremos imprimir la fila de la tabla a menos que exista
|
|
|
|
|
|
contenido para desplegar *}
|
|
|
|
|
|
{capture name=banner}
|
|
|
|
|
|
{include file="get_banner.tpl"}
|
|
|
|
|
|
{/capture}
|
|
|
|
|
|
{if $smarty.capture.banner ne ""}
|
|
|
|
|
|
<tr>
|
|
|
|
|
|
<td>
|
|
|
|
|
|
{$smarty.capture.banner}
|
|
|
|
|
|
</td>
|
|
|
|
|
|
</tr>
|
|
|
|
|
|
{/if}
|
|
|
|
|
|
]]>
|
|
|
|
|
|
</programlisting>
|
|
|
|
|
|
</example>
|
|
|
|
|
|
</para>
|
2005-11-08 23:37:29 +00:00
|
|
|
|
<para>
|
|
|
|
|
|
Ver Tambi<62>n
|
|
|
|
|
|
<link linkend="language.variables.smarty.capture">$smarty.capture</link>,
|
|
|
|
|
|
<link linkend="language.function.eval">{eval}</link>,
|
|
|
|
|
|
<link linkend="language.function.fetch">{fetch}</link>,
|
|
|
|
|
|
<link linkend="api.fetch">fetch()</link>
|
|
|
|
|
|
y <link linkend="language.function.assign">{assign}</link>.
|
|
|
|
|
|
</para>
|
|
|
|
|
|
|
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
|
|
|
|
|
|
-->
|