mirror of
https://github.com/smarty-php/smarty.git
synced 2025-11-12 01:49:53 +01:00
123 lines
4.2 KiB
XML
123 lines
4.2 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision$ -->
|
|
<!-- EN-Revision: 1.2 Maintainer: thomasgm Status: ready -->
|
|
<sect1 id="language.function.counter">
|
|
<title>counter</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 contador</entry>
|
|
</row>
|
|
<row>
|
|
<entry>start</entry>
|
|
<entry>number</entry>
|
|
<entry>Não</entry>
|
|
<entry><emphasis>1</emphasis></entry>
|
|
<entry>O número no qual a contagem se inicia</entry>
|
|
</row>
|
|
<row>
|
|
<entry>skip</entry>
|
|
<entry>number</entry>
|
|
<entry>Não</entry>
|
|
<entry><emphasis>1</emphasis></entry>
|
|
<entry>O intervalo entre as contagens</entry>
|
|
</row>
|
|
<row>
|
|
<entry>direction</entry>
|
|
<entry>string</entry>
|
|
<entry>Não</entry>
|
|
<entry><emphasis>up</emphasis></entry>
|
|
<entry>A direção para contar (up/down)</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>assign</entry>
|
|
<entry>string</entry>
|
|
<entry>Não</entry>
|
|
<entry><emphasis>n/a</emphasis></entry>
|
|
<entry>A variável de template que vai
|
|
receber a saída</entry>
|
|
</row>
|
|
</tbody>
|
|
</tgroup>
|
|
</informaltable>
|
|
<para>
|
|
counter é usada para mostrar uma contagem. counter irá se lembrar de
|
|
count em cada interação. Você pode ajustar o número, o intervalo
|
|
e a direção da contagem, assim como detrminar quando
|
|
mostrar ou não a contagem. Você pode ter vários contadores ao
|
|
mesmo tempo, dando um nome único para cada um. Se você não der um nome,
|
|
o nome 'default' será usado.
|
|
</para>
|
|
<para>
|
|
Se você indicar o atributo especial "assign", a saída da função counter
|
|
será passada para essa variável de template ao invés de
|
|
ser mostrada no template.
|
|
</para>
|
|
<example>
|
|
<title>counter</title>
|
|
<programlisting>
|
|
<![CDATA[
|
|
{* inicia a contagem *}
|
|
{counter start=0 skip=2 print=false}
|
|
|
|
{counter}<br>
|
|
{counter}<br>
|
|
{counter}<br>
|
|
{counter}<br>
|
|
|
|
MOSTRA:
|
|
|
|
2<br>
|
|
4<br>
|
|
6<br>
|
|
8<br>
|
|
]]>
|
|
</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
|
|
--> |