mirror of
https://github.com/smarty-php/smarty.git
synced 2025-11-05 14:51:37 +01:00
139 lines
4.6 KiB
XML
139 lines
4.6 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: 1.2 Maintainer: thomasgm Status: ready -->
|
|
<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>Obrigatório</entry>
|
|
<entry>Padrão</entry>
|
|
<entry>Descrição</entry>
|
|
</row>
|
|
</thead>
|
|
<tbody>
|
|
<row>
|
|
<entry>name</entry>
|
|
<entry>string</entry>
|
|
<entry>Nã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/d</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ã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ão</entry>
|
|
<entry><emphasis>true</emphasis></entry>
|
|
<entry>Quando avançar ou não para o próximo valor</entry>
|
|
</row>
|
|
<row>
|
|
<entry>delimiter</entry>
|
|
<entry>string</entry>
|
|
<entry>Nã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ão</entry>
|
|
<entry><emphasis>n/d</emphasis></entry>
|
|
<entry>A variável de template que
|
|
receberá a saída</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
<para>
|
|
Cycle é usado para fazer um clico atravé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ê pode usar o cycle em mais de um conjunto de valores
|
|
no seu template. Dê a cada conjunto de valores
|
|
um nome único.
|
|
</para>
|
|
<para>
|
|
Você pode fazer com que o valor atual não seja mostrado
|
|
definindo o atributo print para false. Isto é útil para
|
|
pular um valor.
|
|
</para>
|
|
<para>
|
|
O atributo advance é usado para repetir um valor. Quando definido
|
|
para false, a próxima chamada para cycle irá mostrar o mesmo valor.
|
|
</para>
|
|
<para>
|
|
Se você indicar o atributo especial "assign", a saída da função
|
|
cycle será passada para uma variável de template ao invés de ser
|
|
mostrado diretamente no 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}
|
|
|
|
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
|
|
--> |