2004-04-13 15:43:47 +00:00
|
|
|
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
|
|
|
|
<!-- $Revision$ -->
|
2004-12-21 21:08:13 +00:00
|
|
|
|
<!-- EN-Revision: 1.5 Maintainer: gerald Status: ready -->
|
2004-05-23 15:44:59 +00:00
|
|
|
|
<sect1 id="language.function.section">
|
2004-12-21 21:08:13 +00:00
|
|
|
|
<title>section, sectionelse</title>
|
2004-05-23 15:44:59 +00:00
|
|
|
|
<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>Nom attribut</entry>
|
|
|
|
|
|
<entry>Type</entry>
|
|
|
|
|
|
<entry>Requis</entry>
|
|
|
|
|
|
<entry>Defaut</entry>
|
|
|
|
|
|
<entry>Description</entry>
|
|
|
|
|
|
</row>
|
|
|
|
|
|
</thead>
|
|
|
|
|
|
<tbody>
|
|
|
|
|
|
<row>
|
|
|
|
|
|
<entry>name</entry>
|
|
|
|
|
|
<entry>cha<EFBFBD>ne de caract<63>re</entry>
|
|
|
|
|
|
<entry>Oui</entry>
|
|
|
|
|
|
<entry><emphasis>n/a</emphasis></entry>
|
|
|
|
|
|
<entry>Le nom de la section</entry>
|
|
|
|
|
|
</row>
|
|
|
|
|
|
<row>
|
|
|
|
|
|
<entry>loop</entry>
|
2004-12-21 21:08:13 +00:00
|
|
|
|
<entry>mixed</entry>
|
2004-05-23 15:44:59 +00:00
|
|
|
|
<entry>Oui</entry>
|
|
|
|
|
|
<entry><emphasis>n/a</emphasis></entry>
|
2004-12-21 21:08:13 +00:00
|
|
|
|
<entry>valeur qui d<>termine le nombre de fois que la boucle sera ex<65>cut<75>e.</entry>
|
2004-05-23 15:44:59 +00:00
|
|
|
|
</row>
|
|
|
|
|
|
<row>
|
|
|
|
|
|
<entry>start</entry>
|
|
|
|
|
|
<entry>entier</entry>
|
|
|
|
|
|
<entry>Non</entry>
|
|
|
|
|
|
<entry><emphasis>0</emphasis></entry>
|
|
|
|
|
|
<entry>La position de l'index ou la section commencera son
|
|
|
|
|
|
parcours. Si la valeur donn<6E>e est n<>gative, la position de
|
|
|
|
|
|
d<>part est calcul<75>e depuis la fin du tableau. Par exemple,
|
|
|
|
|
|
s'il existe 7 valeurs dans le tableau <20> parcourir et que start
|
|
|
|
|
|
est <20> -2, l'index de d<>part sera 5. Les valeurs incorrectes
|
|
|
|
|
|
(en dehors de la port<72>e du tableau) sont automatiquements
|
|
|
|
|
|
tronqu<71>es <20> la valeur correcte la plus proche.</entry>
|
|
|
|
|
|
</row>
|
|
|
|
|
|
<row>
|
|
|
|
|
|
<entry>step</entry>
|
|
|
|
|
|
<entry>entier</entry>
|
|
|
|
|
|
<entry>Non</entry>
|
|
|
|
|
|
<entry><emphasis>1</emphasis></entry>
|
|
|
|
|
|
<entry>La valeur du pas qui sera utilis<69> pour parcourir le
|
|
|
|
|
|
tableau.Par exemple, step=2 parcourera les indices
|
|
|
|
|
|
0,2,4, etc. Si step est n<>gatif, le tableau sera parcouru en sens
|
|
|
|
|
|
inverse.</entry>
|
|
|
|
|
|
</row>
|
|
|
|
|
|
<row>
|
|
|
|
|
|
<entry>max</entry>
|
|
|
|
|
|
<entry>entier</entry>
|
|
|
|
|
|
<entry>Non</entry>
|
|
|
|
|
|
<entry><emphasis>1</emphasis></entry>
|
|
|
|
|
|
<entry>D<EFBFBD>finit le nombre maximum de fois que le tableau sera
|
|
|
|
|
|
parcouru.</entry>
|
|
|
|
|
|
</row>
|
|
|
|
|
|
<row>
|
|
|
|
|
|
<entry>show</entry>
|
|
|
|
|
|
<entry>bool<EFBFBD>en</entry>
|
|
|
|
|
|
<entry>Non</entry>
|
|
|
|
|
|
<entry><emphasis>true</emphasis></entry>
|
|
|
|
|
|
<entry>D<EFBFBD>termine s'il est n<>cessaire d'afficher la
|
|
|
|
|
|
section ou non.</entry>
|
|
|
|
|
|
</row>
|
|
|
|
|
|
</tbody>
|
|
|
|
|
|
</tgroup>
|
|
|
|
|
|
</informaltable>
|
|
|
|
|
|
<para>
|
|
|
|
|
|
Les balises <emphasis>section</emphasis> sont utilis<69>es pour
|
|
|
|
|
|
parcourir un tableau de donn<6E>es. Toutes les balises
|
|
|
|
|
|
<emphasis>section</emphasis> doivent <20>tre utilis<69>es de paire avec
|
|
|
|
|
|
les balises <emphasis>/section</emphasis>. Les param<61>tres requis
|
|
|
|
|
|
sont <emphasis>name</emphasis> et <emphasis>loop</emphasis>.
|
|
|
|
|
|
Le nom de la section est, selon votre choix, compos<6F> de lettres,
|
|
|
|
|
|
chiffres et underscores. Les sections peuvent <20>tre imbriqu<71>es,
|
|
|
|
|
|
mais leurs noms doivent <20>tre uniques. La variable de parcours
|
|
|
|
|
|
(g<>n<EFBFBD>ralement un tableau de donn<6E>es) d<>termine le nombre de fois
|
|
|
|
|
|
que la section sera parcourue. Lorsque l'on affiche une variable
|
|
|
|
|
|
dans une section, le nom de la section doit pr<70>c<EFBFBD>der
|
|
|
|
|
|
la variable entre crochets. <emphasis>sectionelse</emphasis>
|
|
|
|
|
|
est ex<65>cut<75> lorsqu'aucune valeur n'est trouv<75>e dans la variable <20>
|
|
|
|
|
|
parcourir.
|
|
|
|
|
|
</para>
|
|
|
|
|
|
<example>
|
|
|
|
|
|
<title>section</title>
|
2004-04-13 15:43:47 +00:00
|
|
|
|
<programlisting>
|
|
|
|
|
|
|
2004-06-08 17:38:57 +00:00
|
|
|
|
{* Cet exemple va afficher toutes les valeurs du tableau $idClient *}
|
|
|
|
|
|
{section name=client loop=$idClient}
|
|
|
|
|
|
id: {$idClient[client]}<br>
|
2004-04-13 15:43:47 +00:00
|
|
|
|
{/section}
|
|
|
|
|
|
|
|
|
|
|
|
SORTIE:
|
|
|
|
|
|
|
|
|
|
|
|
id: 1000<br>
|
|
|
|
|
|
id: 1001<br>
|
|
|
|
|
|
id: 1002<br></programlisting>
|
2004-05-23 15:44:59 +00:00
|
|
|
|
</example>
|
|
|
|
|
|
|
|
|
|
|
|
<example>
|
|
|
|
|
|
<title>section, variable de parcours</title>
|
2004-04-13 15:43:47 +00:00
|
|
|
|
<programlisting>
|
|
|
|
|
|
{* La variable de parcours d<>termine uniquement le nombre de fois que nous allons
|
|
|
|
|
|
rentrer dans la boucle. Vous pouvez acc<63>der <20> toutes les variables du template
|
|
|
|
|
|
lorsque vous <20>tes dans une section. Cet exemple part du principe que
|
|
|
|
|
|
$idClient, $noms et $adresses sont tous des tableaux qui contiennent
|
|
|
|
|
|
autant de valeurs les uns que les autres.*}
|
2004-06-08 17:38:57 +00:00
|
|
|
|
{section name=client loop=$idClient}
|
2004-04-13 15:43:47 +00:00
|
|
|
|
id: {$idClient[client]}<br>
|
|
|
|
|
|
nom: {$noms[client]}<br>
|
|
|
|
|
|
addresse: {$addresses[client]}<br>
|
|
|
|
|
|
<p>
|
|
|
|
|
|
{/section}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SORTIE:
|
|
|
|
|
|
|
|
|
|
|
|
id: 1000<br>
|
|
|
|
|
|
nom: John Smith<br>
|
|
|
|
|
|
addresse: 253 N 45th<br>
|
|
|
|
|
|
<p>
|
|
|
|
|
|
id: 1001<br>
|
|
|
|
|
|
nom: Jack Jones<br>
|
|
|
|
|
|
addresse: 417 Mulberry ln<br>
|
|
|
|
|
|
<p>
|
|
|
|
|
|
id: 1002<br>
|
|
|
|
|
|
nom: Jane Munson<br>
|
|
|
|
|
|
addresse: 5605 apple st<br>
|
|
|
|
|
|
<p></programlisting>
|
2004-05-23 15:44:59 +00:00
|
|
|
|
</example>
|
|
|
|
|
|
|
|
|
|
|
|
<example>
|
|
|
|
|
|
<title>nom de section</title>
|
2004-04-13 15:43:47 +00:00
|
|
|
|
<programlisting>
|
|
|
|
|
|
{* Le nom de la section peut <20>tre ce que vous voulez,
|
|
|
|
|
|
et est utilis<69> pour r<>f<EFBFBD>rencer les donn<6E>es depuis la section. *}
|
|
|
|
|
|
{section name=monTableau loop=$idClient}
|
|
|
|
|
|
id: {$idCLient[monTableau]}<br>
|
|
|
|
|
|
name: {$noms[monTableau]}<br>
|
|
|
|
|
|
address: {$addresses[monTableau]}<br>
|
|
|
|
|
|
<p>
|
|
|
|
|
|
{/section}</programlisting>
|
2004-05-23 15:44:59 +00:00
|
|
|
|
</example>
|
|
|
|
|
|
|
|
|
|
|
|
<example>
|
|
|
|
|
|
<title>sections imbriqu<71>es</title>
|
2004-04-13 15:43:47 +00:00
|
|
|
|
<programlisting>
|
|
|
|
|
|
{* Les sections peuvent <20>tre imbriqu<71>es <20> un nombre de niveaux illimit<69>.
|
|
|
|
|
|
Gr<47>ce aux sections imbriqu<71>es, vous pouvez acc<63>der <20> des structures de donn<6E>es
|
|
|
|
|
|
complexes, comme des tableaux multi-dimentionnels. Dans cet exemple,
|
|
|
|
|
|
$type_contact[client] est un tableau de type de contact pour le client
|
|
|
|
|
|
courant. *}
|
2004-06-08 17:38:57 +00:00
|
|
|
|
{section name=client loop=$idClient}
|
2004-12-21 21:08:13 +00:00
|
|
|
|
id: {$idClient[client]}<br>
|
|
|
|
|
|
nom: {$nom[client]}<br>
|
|
|
|
|
|
addresse: {$addresse[client]}<br>
|
|
|
|
|
|
{section name=contact loop=$type_contact[client]}
|
|
|
|
|
|
{$type_contact[client][contact]}: {$info_contact[client][contact]}<br>
|
|
|
|
|
|
{/section}
|
|
|
|
|
|
<p>
|
2004-04-13 15:43:47 +00:00
|
|
|
|
{/section}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SORTIE:
|
|
|
|
|
|
|
|
|
|
|
|
id: 1000<br>
|
|
|
|
|
|
nom: John Smith<br>
|
|
|
|
|
|
addresse: 253 N 45th<br>
|
|
|
|
|
|
telephone: 555-555-5555<br>
|
|
|
|
|
|
telephone portable: 555-555-5555<br>
|
2004-12-21 21:08:13 +00:00
|
|
|
|
e-mail: john@myexample.com<br>
|
2004-04-13 15:43:47 +00:00
|
|
|
|
<p>
|
|
|
|
|
|
id: 1001<br>
|
|
|
|
|
|
nom: Jack Jones<br>
|
|
|
|
|
|
addresse: 417 Mulberry ln<br>
|
|
|
|
|
|
telephone: 555-555-5555<br>
|
|
|
|
|
|
telephone portable: 555-555-5555<br>
|
2004-12-21 21:08:13 +00:00
|
|
|
|
e-mail: jack@myexample.com<br>
|
2004-04-13 15:43:47 +00:00
|
|
|
|
<p>
|
|
|
|
|
|
id: 1002<br>
|
|
|
|
|
|
nom: Jane Munson<br>
|
|
|
|
|
|
addresse: 5605 apple st<br>
|
|
|
|
|
|
telephone: 555-555-5555<br>
|
|
|
|
|
|
telephone portable: 555-555-5555<br>
|
2004-12-21 21:08:13 +00:00
|
|
|
|
e-mail: jane@myexample.com<br>
|
2004-04-13 15:43:47 +00:00
|
|
|
|
<p></programlisting>
|
2004-05-23 15:44:59 +00:00
|
|
|
|
</example>
|
|
|
|
|
|
|
|
|
|
|
|
<example>
|
|
|
|
|
|
<title>Sections et tableaux associatifs</title>
|
2004-04-13 15:43:47 +00:00
|
|
|
|
<programlisting>
|
|
|
|
|
|
{* Exemple d'affichage d'un tableau associatif dans une section *}
|
|
|
|
|
|
{section name=client loop=$contacts}
|
2004-12-21 21:08:13 +00:00
|
|
|
|
nom: {$contacts[client].name}<br>
|
|
|
|
|
|
telephone: {$contacts[client].home}<br>
|
|
|
|
|
|
portable: {$contacts[client].cell}<br>
|
|
|
|
|
|
e-mail: {$contacts[client].email}<p>
|
2004-04-13 15:43:47 +00:00
|
|
|
|
{/section}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SORTIE:
|
|
|
|
|
|
|
|
|
|
|
|
nom: John Smith<br>
|
|
|
|
|
|
telephone: 555-555-5555<br>
|
|
|
|
|
|
portable: 555-555-5555<br>
|
2004-12-21 21:08:13 +00:00
|
|
|
|
e-mail: john@myexample.com<p>
|
2004-04-13 15:43:47 +00:00
|
|
|
|
nom: Jack Jones<br>
|
|
|
|
|
|
telephone: 555-555-5555<br>
|
|
|
|
|
|
portable: 555-555-5555<br>
|
2004-12-21 21:08:13 +00:00
|
|
|
|
e-mail: jack@myexample.com<p>
|
2004-04-13 15:43:47 +00:00
|
|
|
|
nom: Jane Munson<br>
|
|
|
|
|
|
telephone: 555-555-5555<br>
|
|
|
|
|
|
portable: 555-555-5555<br>
|
2004-12-21 21:08:13 +00:00
|
|
|
|
e-mail: jane@myexample.com<p></programlisting>
|
2004-05-23 15:44:59 +00:00
|
|
|
|
</example>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<example>
|
|
|
|
|
|
<title>sectionelse</title>
|
2004-04-13 15:43:47 +00:00
|
|
|
|
<programlisting>
|
|
|
|
|
|
{* sectionelse est ex<65>cut<75> s'il n'existe aucune valeur dans idClient *}
|
|
|
|
|
|
{section name=client loop=$idClient}
|
2004-12-21 21:08:13 +00:00
|
|
|
|
id: {$idClient[client]}<br>
|
2004-04-13 15:43:47 +00:00
|
|
|
|
{sectionelse}
|
2004-12-21 21:08:13 +00:00
|
|
|
|
Aucune valeur dans $idClient.
|
2004-04-13 15:43:47 +00:00
|
|
|
|
{/section}</programlisting>
|
2004-05-23 15:44:59 +00:00
|
|
|
|
</example>
|
|
|
|
|
|
<para>
|
|
|
|
|
|
Les sections ont leur propre variable de gestion des propri<72>t<EFBFBD>s.
|
|
|
|
|
|
Elles sont de la forme: {$smarty.section.nomSection.nomVariable}
|
|
|
|
|
|
</para>
|
|
|
|
|
|
<para>
|
|
|
|
|
|
NOTE: Depuis Smarty 1.5.0, la syntaxe pour les propi<70>t<EFBFBD>s des sections
|
|
|
|
|
|
a <20>t<EFBFBD> chang<6E>e de {%sectionname.varname%} <20>
|
|
|
|
|
|
{$smarty.section.nomSection.nomVariable}. L'ancienne syntaxe est toujours
|
|
|
|
|
|
support<72>e, mais vous ne verrez que des exemples avec la nouvelle syntaxe
|
|
|
|
|
|
dans le manuel.
|
|
|
|
|
|
</para>
|
|
|
|
|
|
<sect2 id="section.property.index">
|
|
|
|
|
|
<title>index</title>
|
|
|
|
|
|
<para>
|
|
|
|
|
|
Index est utilis<69> pour afficher l'index de parcours courant, commence par
|
|
|
|
|
|
0 (ou l'attribut start), et s'incr<63>mente de 1 (ou de la valeur
|
|
|
|
|
|
de l'attribut step).
|
|
|
|
|
|
</para>
|
|
|
|
|
|
<note>
|
|
|
|
|
|
<title>Note technique</title>
|
|
|
|
|
|
<para>
|
|
|
|
|
|
Si les attributs step et start ne sont pas modifi<66>s, alors index
|
|
|
|
|
|
fonctionne de la m<>me fa<66>on que iteration, <20> l'exception qu'il commence
|
|
|
|
|
|
par 0 plut<75>t que par 1.
|
|
|
|
|
|
</para>
|
|
|
|
|
|
</note>
|
|
|
|
|
|
<example>
|
|
|
|
|
|
<title>propri<EFBFBD>t<EFBFBD> de section index</title>
|
|
|
|
|
|
<programlisting>
|
2004-12-21 21:08:13 +00:00
|
|
|
|
{section name=client loop=$idClient}
|
|
|
|
|
|
{$smarty.section.client.index} id: {$idClient[client]}<br>
|
|
|
|
|
|
{/section}
|
2004-04-13 15:43:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
2004-12-21 21:08:13 +00:00
|
|
|
|
SORTIE:
|
2004-04-13 15:43:47 +00:00
|
|
|
|
|
2004-12-21 21:08:13 +00:00
|
|
|
|
0 id: 1000<br>
|
|
|
|
|
|
1 id: 1001<br>
|
|
|
|
|
|
2 id: 1002<br>
|
2004-04-13 15:43:47 +00:00
|
|
|
|
</programlisting>
|
2004-05-23 15:44:59 +00:00
|
|
|
|
</example>
|
|
|
|
|
|
</sect2>
|
|
|
|
|
|
<sect2 id="section.property.index.prev">
|
|
|
|
|
|
<title>index_prev</title>
|
|
|
|
|
|
<para>
|
|
|
|
|
|
index_prev est utilis<69> pour afficher l'index de parcours
|
|
|
|
|
|
pr<70>c<EFBFBD>dent de la boucle. Au premier passage, il vaut -1.
|
|
|
|
|
|
</para>
|
|
|
|
|
|
<example>
|
|
|
|
|
|
<title>propri<EFBFBD>t<EFBFBD> de section index_prev</title>
|
|
|
|
|
|
<programlisting>
|
2004-12-21 21:08:13 +00:00
|
|
|
|
{section name=client loop=$idClient}
|
|
|
|
|
|
{$smarty.section.client.index} id: {$idClient[client]}<br>
|
|
|
|
|
|
{* Pour votre information, $idClient[client.index] and $idClient[client] sont identiques *}
|
|
|
|
|
|
{if $idClient[client.index_prev] ne $idClient[client.index]}
|
|
|
|
|
|
L'id du client <20> <20>t<EFBFBD> modifi<66><br>
|
|
|
|
|
|
{/if}
|
|
|
|
|
|
{/section}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SORTIE:
|
|
|
|
|
|
|
|
|
|
|
|
0 id: 1000<br>
|
|
|
|
|
|
L'id du client <20> <20>t<EFBFBD> modifi<66><br>
|
|
|
|
|
|
1 id: 1001<br>
|
|
|
|
|
|
L'id du client <20> <20>t<EFBFBD> modifi<66><br>
|
|
|
|
|
|
2 id: 1002<br>
|
|
|
|
|
|
L'id du client <20> <20>t<EFBFBD> modifi<66><br>
|
2004-04-13 15:43:47 +00:00
|
|
|
|
</programlisting>
|
2004-05-23 15:44:59 +00:00
|
|
|
|
</example>
|
|
|
|
|
|
</sect2>
|
|
|
|
|
|
<sect2 id="section.property.index.next">
|
|
|
|
|
|
<title>index_next</title>
|
|
|
|
|
|
<para>
|
|
|
|
|
|
index_next est utilis<69> pour afficher la valeur th<74>orique suivante de
|
2004-12-26 21:12:45 +00:00
|
|
|
|
index. Dans la derni<6E>re boucle, cel<65> reste la valeur incr<63>ment<6E>e,
|
2004-05-23 15:44:59 +00:00
|
|
|
|
qui respecte l'attribut step si donn<6E>.
|
|
|
|
|
|
</para>
|
|
|
|
|
|
<example>
|
|
|
|
|
|
<title>propri<EFBFBD>t<EFBFBD> de section index_next</title>
|
|
|
|
|
|
<programlisting>
|
2004-12-21 21:08:13 +00:00
|
|
|
|
{section name=client loop=$idClient}
|
|
|
|
|
|
{$smarty.section.client.index} id: {$idClient[client]}<br>
|
|
|
|
|
|
{* Pour votre information, $idClient[client.index] and $idClient[client] sont identiques *}
|
|
|
|
|
|
{if $idClient[client.index_next] ne $idClient[client.index]}
|
|
|
|
|
|
L'id du client va changer<br>
|
|
|
|
|
|
{/if}
|
|
|
|
|
|
{/section}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SORTIE:
|
|
|
|
|
|
|
|
|
|
|
|
0 id: 1000<br>
|
|
|
|
|
|
L'id du client va changer<br>
|
|
|
|
|
|
1 id: 1001<br>
|
|
|
|
|
|
L'id du client va changer<br>
|
|
|
|
|
|
2 id: 1002<br>
|
|
|
|
|
|
L'id du client va changer<br>
|
2004-04-13 15:43:47 +00:00
|
|
|
|
</programlisting>
|
2004-05-23 15:44:59 +00:00
|
|
|
|
</example>
|
|
|
|
|
|
</sect2>
|
|
|
|
|
|
<sect2 id="section.property.iteration">
|
|
|
|
|
|
<title>iteration</title>
|
|
|
|
|
|
<para>
|
|
|
|
|
|
iteration est utilis<69> pour afficher la valeur courante de l'iteration.
|
|
|
|
|
|
</para>
|
|
|
|
|
|
<para>
|
|
|
|
|
|
NOTE: Cette valeur n'est pas affect<63>e par les attributs start, step et
|
|
|
|
|
|
max, <20> l'inverse de la propri<72>t<EFBFBD> index. L'it<69>ration commence par
|
|
|
|
|
|
1 et non par 0 (comme le fait index). rownum est un alias de iteration,
|
|
|
|
|
|
ils fonctionnent de la m<>me fa<66>on.
|
|
|
|
|
|
</para>
|
|
|
|
|
|
<example>
|
|
|
|
|
|
<title>propri<EFBFBD>t<EFBFBD> iteration de section</title>
|
|
|
|
|
|
<programlisting>
|
2004-12-21 21:08:13 +00:00
|
|
|
|
{section name=client loop=$idClient start=5 step=2}
|
|
|
|
|
|
Iteration courante: {$smarty.section.client.iteration}<br>
|
|
|
|
|
|
{$smarty.section.client.index} id: {$idClient[client]}<br>
|
|
|
|
|
|
{* Pour votre information, $idClient[client.index] and $idClient[client] sont identiques *}
|
|
|
|
|
|
{if $idCLient[client.index_next] ne $idClient[client.index]}
|
|
|
|
|
|
L'id du client va changer<br>
|
|
|
|
|
|
{/if}
|
|
|
|
|
|
{/section}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
SORTIE:
|
|
|
|
|
|
|
|
|
|
|
|
Iteration courante: 1
|
|
|
|
|
|
5 id: 1000<br>
|
|
|
|
|
|
L'id du client va changer<br>
|
|
|
|
|
|
Iteration courante: 2
|
|
|
|
|
|
7 id: 1001<br>
|
|
|
|
|
|
L'id du client va changer<br>
|
|
|
|
|
|
Iteration courante: 3
|
|
|
|
|
|
9 id: 1002<br>
|
|
|
|
|
|
L'id du client va changer<br>
|
2004-04-13 15:43:47 +00:00
|
|
|
|
</programlisting>
|
2004-05-23 15:44:59 +00:00
|
|
|
|
</example>
|
|
|
|
|
|
</sect2>
|
|
|
|
|
|
<sect2 id="section.property.first">
|
|
|
|
|
|
<title>first</title>
|
|
|
|
|
|
<para>
|
|
|
|
|
|
first est <20> true lorsque la section est parcouru pour la premi<6D>re fois.
|
|
|
|
|
|
</para>
|
|
|
|
|
|
<example>
|
|
|
|
|
|
<title>propri<EFBFBD>t<EFBFBD> first de la section</title>
|
|
|
|
|
|
<programlisting>
|
2004-12-21 21:08:13 +00:00
|
|
|
|
{section name=client loop=$idClient}
|
|
|
|
|
|
{if $smarty.section.client.first}
|
|
|
|
|
|
<table>
|
|
|
|
|
|
{/if}
|
2004-04-13 15:43:47 +00:00
|
|
|
|
|
2004-12-21 21:08:13 +00:00
|
|
|
|
<tr><td>{$smarty.section.client.index} id:
|
|
|
|
|
|
{$idClient[client]}</td></tr>
|
2004-04-13 15:43:47 +00:00
|
|
|
|
|
2004-12-21 21:08:13 +00:00
|
|
|
|
{if $smarty.section.client.last}
|
|
|
|
|
|
</table>
|
|
|
|
|
|
{/if}
|
|
|
|
|
|
{/section}
|
2004-04-13 15:43:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
2004-12-21 21:08:13 +00:00
|
|
|
|
SORTIE:
|
2004-04-13 15:43:47 +00:00
|
|
|
|
|
2004-12-21 21:08:13 +00:00
|
|
|
|
<table>
|
|
|
|
|
|
<tr><td>0 id: 1000</td></tr>
|
|
|
|
|
|
<tr><td>1 id: 1001</td></tr>
|
|
|
|
|
|
<tr><td>2 id: 1002</td></tr>
|
|
|
|
|
|
</table>
|
2004-04-13 15:43:47 +00:00
|
|
|
|
</programlisting>
|
2004-05-23 15:44:59 +00:00
|
|
|
|
</example>
|
|
|
|
|
|
</sect2>
|
|
|
|
|
|
<sect2 id="section.property.last">
|
|
|
|
|
|
<title>last</title>
|
|
|
|
|
|
<para>
|
|
|
|
|
|
last est <20> true lorsque la section est parcourue pour la derni<6E>re fois.
|
|
|
|
|
|
</para>
|
|
|
|
|
|
<example>
|
|
|
|
|
|
<title>Propri<EFBFBD>t<EFBFBD> last de section</title>
|
|
|
|
|
|
<programlisting>
|
2004-12-21 21:08:13 +00:00
|
|
|
|
{section name=client loop=$idClient}
|
|
|
|
|
|
{if $smarty.section.client.first}
|
|
|
|
|
|
<table>
|
|
|
|
|
|
{/if}
|
2004-04-13 15:43:47 +00:00
|
|
|
|
|
2004-12-21 21:08:13 +00:00
|
|
|
|
<tr><td>{$smarty.section.client.index} id:
|
|
|
|
|
|
{$idClient[client]}</td></tr>
|
2004-04-13 15:43:47 +00:00
|
|
|
|
|
2004-12-21 21:08:13 +00:00
|
|
|
|
{if $smarty.section.client.last}
|
|
|
|
|
|
</table>
|
|
|
|
|
|
{/if}
|
|
|
|
|
|
{/section}
|
2004-04-13 15:43:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
2004-12-21 21:08:13 +00:00
|
|
|
|
SORTIE:
|
2004-04-13 15:43:47 +00:00
|
|
|
|
|
2004-12-21 21:08:13 +00:00
|
|
|
|
<table>
|
|
|
|
|
|
<tr><td>0 id: 1000</td></tr>
|
|
|
|
|
|
<tr><td>1 id: 1001</td></tr>
|
|
|
|
|
|
<tr><td>2 id: 1002</td></tr>
|
|
|
|
|
|
</table>
|
2004-04-13 15:43:47 +00:00
|
|
|
|
</programlisting>
|
2004-05-23 15:44:59 +00:00
|
|
|
|
</example>
|
|
|
|
|
|
</sect2>
|
|
|
|
|
|
<sect2 id="section.property.rownum">
|
|
|
|
|
|
<title>rownum</title>
|
|
|
|
|
|
<para>
|
|
|
|
|
|
rownum, utilis<69> pour afficher la valeur courante de l'it<69>ration,
|
|
|
|
|
|
commence par 1. C'est un alias de iteration, ils fonctionnent de fa<66>on
|
|
|
|
|
|
identique.
|
|
|
|
|
|
</para>
|
|
|
|
|
|
<example>
|
|
|
|
|
|
<title>propri<EFBFBD>t<EFBFBD> rownum de section</title>
|
|
|
|
|
|
<programlisting>
|
2004-12-21 21:08:13 +00:00
|
|
|
|
{section name=client loop=$idClient}
|
|
|
|
|
|
{$smarty.section.client.rownum} id: {$idClient[client]}<br>
|
|
|
|
|
|
{/section}
|
2004-04-13 15:43:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
2004-12-21 21:08:13 +00:00
|
|
|
|
SORTIE:
|
2004-04-13 15:43:47 +00:00
|
|
|
|
|
2004-12-21 21:08:13 +00:00
|
|
|
|
1 id: 1000<br>
|
|
|
|
|
|
2 id: 1001<br>
|
|
|
|
|
|
3 id: 1002<br>
|
2004-04-13 15:43:47 +00:00
|
|
|
|
</programlisting>
|
2004-05-23 15:44:59 +00:00
|
|
|
|
</example>
|
|
|
|
|
|
</sect2>
|
|
|
|
|
|
<sect2 id="section.property.loop">
|
|
|
|
|
|
<title>loop</title>
|
|
|
|
|
|
<para>
|
|
|
|
|
|
loop est utilis<69> pour afficher la derni<6E>re valeur de index que cette
|
|
|
|
|
|
section a utilis<69>. Peut <20>tre utilis<69> dans ou en dehors de la section.
|
|
|
|
|
|
</para>
|
|
|
|
|
|
<example>
|
|
|
|
|
|
<title>Propri<EFBFBD>t<EFBFBD> de section index</title>
|
|
|
|
|
|
<programlisting>
|
2004-12-21 21:08:13 +00:00
|
|
|
|
{section name=client loop=$idClient}
|
|
|
|
|
|
{$smarty.section.client.index} id: {$idClient[client]}<br>
|
|
|
|
|
|
{/section}
|
2004-04-13 15:43:47 +00:00
|
|
|
|
|
2004-12-21 21:08:13 +00:00
|
|
|
|
Il y eu {$smarty.section.client.loop} clients d'affich<63>s.
|
2004-04-13 15:43:47 +00:00
|
|
|
|
|
2004-12-21 21:08:13 +00:00
|
|
|
|
SORTIE:
|
2004-04-13 15:43:47 +00:00
|
|
|
|
|
2004-12-21 21:08:13 +00:00
|
|
|
|
0 id: 1000<br>
|
|
|
|
|
|
1 id: 1001<br>
|
|
|
|
|
|
2 id: 1002<br>
|
2004-04-13 15:43:47 +00:00
|
|
|
|
|
2004-12-21 21:08:13 +00:00
|
|
|
|
il y eu 3 clients d'affich<63>s.
|
2004-04-13 15:43:47 +00:00
|
|
|
|
</programlisting>
|
2004-05-23 15:44:59 +00:00
|
|
|
|
</example>
|
|
|
|
|
|
</sect2>
|
|
|
|
|
|
<sect2 id="section.property.show">
|
|
|
|
|
|
<title>show</title>
|
|
|
|
|
|
<para>
|
|
|
|
|
|
<emphasis>show</emphasis> est utilis<69> comme param<61>tre de section.
|
|
|
|
|
|
<emphasis>show</emphasis> est une valeur bool<6F>enne, true ou false.
|
|
|
|
|
|
Si show est <20> "false", la section ne sera pas affich<63>e. Si un
|
|
|
|
|
|
sectionelse est pr<70>sent, elle sera affich<63>.
|
|
|
|
|
|
</para>
|
|
|
|
|
|
<example>
|
|
|
|
|
|
<title>section, attribut show</title>
|
|
|
|
|
|
<programlisting>
|
2004-12-21 21:08:13 +00:00
|
|
|
|
{* $show_client_info a pu <20>tre pass<73> par le script PHP,
|
|
|
|
|
|
pour d<>terminer si oui ou non on souhaite afficher la section *}
|
|
|
|
|
|
{section name=client loop=$idClient show=$show_client_info}
|
|
|
|
|
|
{$smarty.section.client.rownum} id: {$idClient[client]}<br>
|
|
|
|
|
|
{/section}
|
2004-04-13 15:43:47 +00:00
|
|
|
|
|
2004-12-21 21:08:13 +00:00
|
|
|
|
{if $smarty.section.client.show}
|
|
|
|
|
|
la section <20> <20>t<EFBFBD> affich<63>e.
|
|
|
|
|
|
{else}
|
|
|
|
|
|
la section n'a pas <20>t<EFBFBD> affich<63>e.
|
|
|
|
|
|
{/if}
|
2004-04-13 15:43:47 +00:00
|
|
|
|
|
|
|
|
|
|
|
2004-12-21 21:08:13 +00:00
|
|
|
|
SORTIE:
|
2004-04-13 15:43:47 +00:00
|
|
|
|
|
2004-12-21 21:08:13 +00:00
|
|
|
|
1 id: 1000<br>
|
|
|
|
|
|
2 id: 1001<br>
|
|
|
|
|
|
3 id: 1002<br>
|
2004-04-13 15:43:47 +00:00
|
|
|
|
|
2004-12-21 21:08:13 +00:00
|
|
|
|
la section <20> <20>t<EFBFBD> affich<63>e.
|
2004-04-13 15:43:47 +00:00
|
|
|
|
</programlisting>
|
2004-05-23 15:44:59 +00:00
|
|
|
|
</example>
|
|
|
|
|
|
</sect2>
|
|
|
|
|
|
<sect2 id="section.property.total">
|
|
|
|
|
|
<title>total</title>
|
|
|
|
|
|
<para>
|
|
|
|
|
|
total est utilis<69> pour afficher le nombre d'it<69>ration que la section
|
|
|
|
|
|
va ex<65>cuter. Peut <20>tre utilis<69> dans ou en dehors de la section.
|
|
|
|
|
|
</para>
|
|
|
|
|
|
<example>
|
|
|
|
|
|
<title>section, propri<72>t<EFBFBD> total</title>
|
|
|
|
|
|
<programlisting>
|
2004-12-21 21:08:13 +00:00
|
|
|
|
{section name=client loop=$idClient step=2}
|
|
|
|
|
|
{$smarty.section.client.index} id: {$idClient[client]}<br>
|
|
|
|
|
|
{/section}
|
2004-04-13 15:43:47 +00:00
|
|
|
|
|
2004-12-21 21:08:13 +00:00
|
|
|
|
Il y eu {$smarty.section.client.total} clients affich<63>s.
|
2004-04-13 15:43:47 +00:00
|
|
|
|
|
2004-12-21 21:08:13 +00:00
|
|
|
|
SORTIE:
|
2004-04-13 15:43:47 +00:00
|
|
|
|
|
2004-12-21 21:08:13 +00:00
|
|
|
|
0 id: 1000<br>
|
|
|
|
|
|
2 id: 1001<br>
|
|
|
|
|
|
4 id: 1002<br>
|
2004-04-13 15:43:47 +00:00
|
|
|
|
|
2004-12-21 21:08:13 +00:00
|
|
|
|
Il y eu 3 clients affich<63>s.
|
2004-04-13 15:43:47 +00:00
|
|
|
|
</programlisting>
|
2004-05-23 15:44:59 +00:00
|
|
|
|
</example>
|
|
|
|
|
|
</sect2>
|
2004-04-13 15:43:47 +00:00
|
|
|
|
</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
|
2004-05-23 15:44:59 +00:00
|
|
|
|
-->
|