Files
smarty/docs/it/designers/language-custom-functions/language-function-cycle.xml

136 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>Nome Attributo</entry>
<entry>Tipo</entry>
<entry>Obbligatorio</entry>
<entry>Default</entry>
<entry>Descrizione</entry>
</row>
</thead>
<tbody>
<row>
<entry>name</entry>
<entry>stringa</entry>
<entry>no</entry>
<entry><emphasis>default</emphasis></entry>
<entry>Nome del ciclo</entry>
</row>
<row>
<entry>values</entry>
<entry>misto</entry>
<entry></entry>
<entry><emphasis>nessuno</emphasis></entry>
<entry>Valori da usare nel ciclo: può essere
una lista delimitata da un separatore (vedere attributo
delimiter), oppure un array di valori.</entry>
</row>
<row>
<entry>print</entry>
<entry>booleano</entry>
<entry>no</entry>
<entry><emphasis>true</emphasis></entry>
<entry>Se stampare il valore oppure no.</entry>
</row>
<row>
<entry>advance</entry>
<entry>booleano</entry>
<entry>no</entry>
<entry><emphasis>true</emphasis></entry>
<entry>Se avanzare o no al prossimo valore.</entry>
</row>
<row>
<entry>delimiter</entry>
<entry>stringa</entry>
<entry>no</entry>
<entry><emphasis>,</emphasis></entry>
<entry>Delimitatore per l'attributo values.</entry>
</row>
<row>
<entry>assign</entry>
<entry>stringa</entry>
<entry>no</entry>
<entry><emphasis>nessuno</emphasis></entry>
<entry>Variabile del template cui assegnare l'output.</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
Cycle si usa per effettuare un ciclo alternato fra un insieme di valori.
Ci dà la possibilità di alternare facilmente due o più colori in una
tabella, o di effettuare un ciclo su un array di valori.
</para>
<para>
Potete effettuare il ciclo su più di un insieme di valori nel template
fornendo l'attributo name, se date ad ogni insieme un nome diverso.
</para>
<para>
Potete evitare che il valore corrente venga stampato impostando
l'attributo set a false. Può essere utile per saltare un valore.
</para>
<para>
L'attributo advance serve per ripetere un valore. Se lo impostate a
false, l'iterazione successiva del ciclo stamperà lo stesso valore.
</para>
<para>
Se fornite lo speciale attributo "assign", l'output della funzione cycle
verrà assegnato a questa variabile invece di essere stampato in output.
</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
-->