Files
smarty/docs/es/designers/language-custom-functions/language-function-cycle.xml
2004-10-07 18:50:52 +00:00

139 lines
3.6 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<sect1 id="language.function.cycle">
<title>cycle</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ón</entry>
</row>
</thead>
<tbody>
<row>
<entry>name</entry>
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>default</emphasis></entry>
<entry>El nombre del ciclo</entry>
</row>
<row>
<entry>values</entry>
<entry>mixed</entry>
<entry>Si</entry>
<entry><emphasis>N/A</emphasis></entry>
<entry>Los valores del ciclo, o una lista delimitada por
coma (vea el atributo delimiter), o una matriz de valores.
</entry>
</row>
<row>
<entry>print</entry>
<entry>boolean</entry>
<entry>No</entry>
<entry><emphasis>true</emphasis></entry>
<entry>Cuando mostrar o no el valor</entry>
</row>
<row>
<entry>advance</entry>
<entry>boolean</entry>
<entry>No</entry>
<entry><emphasis>true</emphasis></entry>
<entry>Cuando avanzar o no hacia el siguiente valor</entry>
</row>
<row>
<entry>delimiter</entry>
<entry>string</entry>
<entry>No</entry>
<entry><emphasis>,</emphasis></entry>
<entry>El delimitador para usar el valor del atributo.</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á la salida</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
Cycle es usado para hacer un ciclo a trav&eacute;s de un conjunto
de valores. Esto hace mas fácil alternar entre dos o mas colores
en una tabla, o ciclos a travéz de una matriz de valores.
</para>
<para>
Usted puede usar el cycle en mas de un conjunto de valores en su
template supliendo el atributo name. De cada uno de los conjuntos
de valores.
</para>
<para>
Usted puede forzar que el valor actual no sea mostrado definiendo
el atributo print en false. Esto es útil para saltarse un valor.
</para>
<para>
El atributo advance es usado para repetir un valor. cuando se
definido en false, la próxima llamada para cycle mostrara el
mismo valor.
</para>
<para>
Si usted indica el atributo especial "assign", la saida de la
función cycle ira a la variable del template en vez de ser mostrado
ditectamente en el template.
</para>
<example>
<title>cycle</title>
<programlisting>
<![CDATA[
{section name=rows loop=$data}
<tr bgcolor="{cycle values="#eeeeee,#d0d0d0"}">
<td>{$data[rows]}</td>
</tr>
{/section}
]]>
</programlisting>
<screen>
<![CDATA[
<tr bgcolor="#eeeeee">
<td>1</td>
</tr>
<tr bgcolor="#d0d0d0">
<td>2</td>
</tr>
<tr bgcolor="#eeeeee">
<td>3</td>
</tr>
]]>
</screen>
</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
-->