mirror of
https://github.com/smarty-php/smarty.git
synced 2025-11-06 15:21:37 +01:00
136 lines
4.6 KiB
XML
136 lines
4.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>Nome do Atributo</entry>
|
|||
|
|
<entry>Tipo</entry>
|
|||
|
|
<entry>Requerido</entry>
|
|||
|
|
<entry>Padr<EFBFBD>o</entry>
|
|||
|
|
<entry>Descri<EFBFBD><EFBFBD>o</entry>
|
|||
|
|
</row>
|
|||
|
|
</thead>
|
|||
|
|
<tbody>
|
|||
|
|
<row>
|
|||
|
|
<entry>name</entry>
|
|||
|
|
<entry>string</entry>
|
|||
|
|
<entry>N<EFBFBD>o</entry>
|
|||
|
|
<entry><emphasis>default</emphasis></entry>
|
|||
|
|
<entry>O nome do ciclo</entry>
|
|||
|
|
</row>
|
|||
|
|
<row>
|
|||
|
|
<entry>values</entry>
|
|||
|
|
<entry>mixed</entry>
|
|||
|
|
<entry>Sim</entry>
|
|||
|
|
<entry><emphasis>N/A</emphasis></entry>
|
|||
|
|
<entry>Os valores do ciclo, ou uma lista delimitada
|
|||
|
|
por v<>rgula (veja o atributo delimiter),
|
|||
|
|
ou uma matriz de valores.</entry>
|
|||
|
|
</row>
|
|||
|
|
<row>
|
|||
|
|
<entry>print</entry>
|
|||
|
|
<entry>boolean</entry>
|
|||
|
|
<entry>N<EFBFBD>o</entry>
|
|||
|
|
<entry><emphasis>true</emphasis></entry>
|
|||
|
|
<entry>Quando mostrar ou n<>o o valor</entry>
|
|||
|
|
</row>
|
|||
|
|
<row>
|
|||
|
|
<entry>advance</entry>
|
|||
|
|
<entry>boolean</entry>
|
|||
|
|
<entry>N<EFBFBD>o</entry>
|
|||
|
|
<entry><emphasis>true</emphasis></entry>
|
|||
|
|
<entry>Quando avan<61>ar ou n<>o para o pr<70>ximo valor</entry>
|
|||
|
|
</row>
|
|||
|
|
<row>
|
|||
|
|
<entry>delimiter</entry>
|
|||
|
|
<entry>string</entry>
|
|||
|
|
<entry>N<EFBFBD>o</entry>
|
|||
|
|
<entry><emphasis>,</emphasis></entry>
|
|||
|
|
<entry>O delimitador para usar no atributo values.</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>
|
|||
|
|
Cycle <20> usado para fazer um clico atrav<61>s de um conjunto de valores.
|
|||
|
|
Isto torna f<>cil alternar entre duas ou mais cores em uma tabela,
|
|||
|
|
ou entre uma matriz de valores.
|
|||
|
|
</para>
|
|||
|
|
<para>
|
|||
|
|
Voc<6F> pode usar o cycle em mais de um conjunto de valores
|
|||
|
|
no seu template. D<> a cada conjunto de valores
|
|||
|
|
um nome <20>nico.
|
|||
|
|
</para>
|
|||
|
|
<para>
|
|||
|
|
Voc<6F> pode fazer com que o valor atual n<>o seja mostrado
|
|||
|
|
definindo o atributo print para false. Isto <20> <20>til para
|
|||
|
|
pular um valor.
|
|||
|
|
</para>
|
|||
|
|
<para>
|
|||
|
|
O atributo advance <20> usado para repetir um valor. Quando definido
|
|||
|
|
para false, a pr<70>xima chamada para cycle ir<69> mostrar o mesmo valor.
|
|||
|
|
</para>
|
|||
|
|
<para>
|
|||
|
|
Se voc<6F> indicar o atributo especial "assign", a sa<73>da da fun<75><6E>o
|
|||
|
|
cycle ir<69> para a vari<72>vel de template ao inv<6E>s de ser
|
|||
|
|
mostrado diretamente no template.
|
|||
|
|
</para>
|
|||
|
|
<example>
|
|||
|
|
<title>cycle</title>
|
|||
|
|
<programlisting>
|
|||
|
|
{section name=rows loop=$data}
|
|||
|
|
<tr bgcolor="{cycle values="#eeeeee,#d0d0d0"}">
|
|||
|
|
<td>{$data[rows]}</td>
|
|||
|
|
</tr>
|
|||
|
|
{/section}
|
|||
|
|
|
|||
|
|
MOSTRA:
|
|||
|
|
|
|||
|
|
<tr bgcolor="#eeeeee">
|
|||
|
|
<td>1</td>
|
|||
|
|
</tr>
|
|||
|
|
<tr bgcolor="#d0d0d0">
|
|||
|
|
<td>2</td>
|
|||
|
|
</tr>
|
|||
|
|
<tr bgcolor="#eeeeee">
|
|||
|
|
<td>3</td>
|
|||
|
|
</tr>
|
|||
|
|
</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
|
|||
|
|
-->
|