cvs: smarty /docs/fr getting-started.xml /docs/fr/designers/language-builtin-functions language-function-if.xml language-function-include.xml language-function-section.xml language-function-strip.xml /docs/fr/designers/language-variables language-assigned-variables.xml language-config-variables.xml language-variables-smarty.xml
[email protected] ("Yannick Torres") Sat, 10 Dec 2005 22:09:39 -0000
| Newsgroups | php.smarty.cvs |
|---|---|
| Message-ID | <cvsyannick1134252579@cvsserver> |
yannick Sat Dec 10 17:09:39 2005 EDT
Modified files:
/smarty/docs/fr/designers/language-builtin-functions
language-function-if.xml
language-function-include.xml
language-function-section.xml
language-function-strip.xml
/smarty/docs/fr/designers/language-variables
language-assigned-variables.xml
language-config-variables.xml
language-variables-smarty.xml
/smarty/docs/fr getting-started.xml
Log:
sync with EN
yannick-20051210170939.txt
(text/plain, 52.9 KB)
http://cvs.php.net/diff.php/smarty/docs/fr/designers/language-builtin-functions/language-function-if.xml?r1=1.8&r2=1.9&ty=u
Index: smarty/docs/fr/designers/language-builtin-functions/language-function-if.xml
diff -u smarty/docs/fr/designers/language-builtin-functions/language-function-if.xml:1.8 smarty/docs/fr/designers/language-builtin-functions/language-function-if.xml:1.9
--- smarty/docs/fr/designers/language-builtin-functions/language-function-if.xml:1.8 Thu Dec 1 15:28:15 2005
+++ smarty/docs/fr/designers/language-builtin-functions/language-function-if.xml Sat Dec 10 17:09:36 2005
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.8 $ -->
-<!-- EN-Revision: 1.7 Maintainer: gerald Status: ready -->
+<!-- $Revision: 1.9 $ -->
+<!-- EN-Revision: 1.8 Maintainer: yannick Status: ready -->
<sect1 id="language.function.if">
<title>{if},{elseif},{else}</title>
@@ -17,6 +17,11 @@
<emphasis>is_array()</emphasis>, etc.
</para>
<para>
+ Si <link linkend="variable.security">$security</link> est actif,
+ alors le tableau <emphasis>IF_FUNCS</emphasis> dans le tableau
+ <link linkend="variable.security.settings">$security_settings</link> (?!).
+ </para>
+ <para>
La liste suivante présente les opérateurs reconnus, qui doivent être entourés d'espaces.
Remarquez que les éléments listés entre [crochets] sont optionnels. Les équivalents
PHP sont indiqués lorsque applicables.
@@ -162,13 +167,6 @@
...
{/if}
-{* l'exemple suivant NE fonctionne PAS, les opérateurs
-doivent être entourés d'espaces. *}
-{if $name=="Fred" || $name=="Wilma"}
- ...
-{/if}
-
-
{* les parenthèses sont autorisées *}
{if ( $amount < 0 or $amount > 1000 ) and $volume >= #minVolAmt#}
...
@@ -179,6 +177,16 @@
...
{/if}
+{* Vérifie si c'est un tableau. *}
+{if is_array($foo) }
+.....
+{/if}
+
+{* Vérifie si la variable est nulle. *}
+{if isset($foo) }
+ .....
+{/if}
+
{* teste si les valeurs sont paires(even) ou impaires(odd) *}
{if $var is even}
...
@@ -206,17 +214,6 @@
...
{/if}
-{* ------- if avec des fonctions PHP ------- *}
-{* check for array. *}
-{if is_array($foo) }
-.....
-{/if}
-
-{* vérification du tableau. *}
-{if isset($foo) }
-.....
-{/if}
-
]]>
</programlisting>
</example>
http://cvs.php.net/diff.php/smarty/docs/fr/designers/language-builtin-functions/language-function-include.xml?r1=1.8&r2=1.9&ty=u
Index: smarty/docs/fr/designers/language-builtin-functions/language-function-include.xml
diff -u smarty/docs/fr/designers/language-builtin-functions/language-function-include.xml:1.8 smarty/docs/fr/designers/language-builtin-functions/language-function-include.xml:1.9
--- smarty/docs/fr/designers/language-builtin-functions/language-function-include.xml:1.8 Thu Dec 1 15:28:15 2005
+++ smarty/docs/fr/designers/language-builtin-functions/language-function-include.xml Sat Dec 10 17:09:36 2005
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.8 $ -->
-<!-- EN-Revision: 1.9 Maintainer: gerald Status: ready -->
+<!-- $Revision: 1.9 $ -->
+<!-- EN-Revision: 1.10 Maintainer: yannick Status: ready -->
<sect1 id="language.function.include">
<title>{include}</title>
@@ -17,6 +17,13 @@
qui définit une variable de template dans laquelle la sortie de
{include} sera stockée plutôt qu'affichée.
</para>
+ <para>
+ Toutes les valeurs des variables assignées sont restaurées lorsque
+ le template inclus est terminé. Ceci signifie que vous pouvez utiliser
+ toutes les variables d'un template inclus dans le template qui l'inclut.
+ Mais les modifications des variables dans le template inclus ne sont pas
+ visibles dans le template qui l'inclut après l'instruction {include}.
+ </para>
<informaltable frame="all">
<tgroup cols="5">
http://cvs.php.net/diff.php/smarty/docs/fr/designers/language-builtin-functions/language-function-section.xml?r1=1.8&r2=1.9&ty=u
Index: smarty/docs/fr/designers/language-builtin-functions/language-function-section.xml
diff -u smarty/docs/fr/designers/language-builtin-functions/language-function-section.xml:1.8 smarty/docs/fr/designers/language-builtin-functions/language-function-section.xml:1.9
--- smarty/docs/fr/designers/language-builtin-functions/language-function-section.xml:1.8 Tue May 24 16:46:11 2005
+++ smarty/docs/fr/designers/language-builtin-functions/language-function-section.xml Sat Dec 10 17:09:36 2005
@@ -1,8 +1,26 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.8 $ -->
-<!-- EN-Revision: 1.8 Maintainer: gerald Status: ready -->
+<!-- $Revision: 1.9 $ -->
+<!-- EN-Revision: 1.14 Maintainer: yannick Status: ready -->
+
<sect1 id="language.function.section">
- <title>section, sectionelse</title>
+ <title>{section},{sectionelse}</title>
+ <para>
+ Les balises <emphasis>section</emphasis> sont utilisées pour
+ parcourir un <emphasis role="bold">tableau de données</emphasis>
+ (tout comme <link linkend="language.function.foreach">{foreach}</link>).
+ Toutes les balises <emphasis>{section}</emphasis> doivent être utilisées
+ de paire avec les balises <emphasis>{/section}</emphasis>. Les paramètres
+ requis sont <emphasis>name</emphasis> et <emphasis>loop</emphasis>.
+ Le nom de la {section} est, selon votre choix, composé de lettres,
+ chiffres et underscores. Les sections peuvent être imbriquées,
+ mais leurs noms doivent être uniques. La variable de parcours
+ (généralement un tableau de donné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écéder
+ la variable entre crochets []. <emphasis>{sectionelse}</emphasis>
+ est exécuté lorsqu'aucune valeur n'est trouvée dans la variable à
+ parcourir.
+ </para>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" align="center" />
@@ -76,29 +94,30 @@
</tbody>
</tgroup>
</informaltable>
- <para>
- Les balises <emphasis>section</emphasis> sont utilisées pour
- parcourir un tableau de données. Toutes les balises
- <emphasis>{section}</emphasis> doivent être utilisées de paire avec
- les balises <emphasis>{/section}</emphasis>. Les paramètres requis
- sont <emphasis>name</emphasis> et <emphasis>loop</emphasis>.
- Le nom de la {section} est, selon votre choix, composé de lettres,
- chiffres et underscores. Les sections peuvent être imbriquées,
- mais leurs noms doivent être uniques. La variable de parcours
- (généralement un tableau de donné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écéder
- la variable entre crochets. <emphasis>{sectionelse}</emphasis>
- est exécuté lorsqu'aucune valeur n'est trouvée dans la variable à
- parcourir.
- </para>
+
<example>
- <title>section</title>
+ <title>{section}</title>
+
+ <programlisting role="php">
+<![CDATA[
+<?php
+
+$data = array(1000,1001,1002);
+$smarty->assign('custid',$data);
+
+?>
+]]>
+ </programlisting>
<programlisting>
<![CDATA[
-{* Cet exemple va afficher toutes les valeurs du tableau $idClient *}
-{section name=client loop=$idClient}
- id: {$idClient[client]}<br />
+{* Cet exemple affiche toutes les valeurs du tableau $custid *}
+{section name=customer loop=$custid}
+ id: {$custid[customer]}<br />
+{/section}
+<hr />
+{* Affiche toutes les valeurs du tableau $custid dans le sens inverse *}
+{section name=foo loop=$custid step=-1}
+ {$custid[foo]}<br />
{/section}
]]>
</programlisting>
@@ -110,23 +129,69 @@
id: 1000<br />
id: 1001<br />
id: 1002<br />
+<hr />
+id: 1002<br />
+id: 1001<br />
+id: 1000<br />
+]]>
+ </screen>
+ <para>
+ Voici d'autres exemples sans tableaux assignés.
+ </para>
+ <programlisting>
+<![CDATA[
+{section name=foo start=10 loop=20 step=2}
+{$smarty.section.foo.index}
+{/section}
+<hr />
+{section name=bar loop=21 max=6 step=-2}
+{$smarty.section.bar.index}
+{/section}
+]]>
+ </programlisting>
+ <para>
+ L'exemple ci-dessus affichera :
+ </para>
+ <screen>
+<![CDATA[
+10 12 14 16 18
+<hr />
+20 18 16 14 12 10
]]>
</screen>
</example>
<example>
- <title>section, variable de parcours</title>
+ <title>{section}, variable de parcours</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+
+$id = array(1001,1002,1003);
+$smarty->assign('custid',$id);
+
+$fullnames = array('John Smith','Jack Jones','Jane Munson');
+$smarty->assign('name',$fullnames);
+
+$addr = array('253 N 45th', '417 Mulberry ln', '5605 apple st');
+$smarty->assign('address',$addr);
+
+?>
+]]>
+ </programlisting>
<programlisting>
<![CDATA[
-{* La variable de parcours détermine uniquement le nombre de fois que nous allons
+{*
+ La variable de parcours détermine uniquement le nombre de fois que nous allons
rentrer dans la boucle. Vous pouvez accéder à toutes les variables du template
lorsque vous ê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.*}
+ autant de valeurs les uns que les autres.
+*}
{section name=client loop=$idClient}
- id: {$idClient[client]}<br />
- nom: {$noms[client]}<br />
- addresse: {$addresses[client]}<br />
+ id : {$custid[customer]}<br />
+ nom : {$name[customer]}<br />
+ addresse : {$address[customer]}<br />
<p>
{/section}
]]>
@@ -136,33 +201,39 @@
</para>
<screen>
<![CDATA[
-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 />
+ id : 1000<br />
+ nom : John Smith<br />
+ addresse : 253 N 45th
+</p>
<p>
-id: 1002<br />
-nom: Jane Munson<br />
-addresse: 5605 apple st<br />
+ id : 1001<br />
+ nom : Jack Jones<br />
+ addresse : 417 Mulberry ln
+</p>
<p>
+ id : 1002<br />
+ nom : Jane Munson<br />
+ addresse : 5605 apple st
+</p>
]]>
</screen>
</example>
<example>
- <title>nom de section</title>
+ <title>nom de {section}</title>
<programlisting>
<![CDATA[
-{* Le nom de la section peut être ce que vous voulez,
- et est utilisé pour référencer les données depuis la section. *}
+{*
+ Le nom de la section peut être ce que vous voulez,
+ et est utilisé pour référencer les données depuis la section.
+*}
{section name=monTableau loop=$idClient}
+<p>
id: {$idCLient[monTableau]}<br />
name: {$noms[monTableau]}<br />
- address: {$addresses[monTableau]}<br />
- <p>
+ address: {$addresses[monTableau]}
+ </p>
{/section}
]]>
</programlisting>
@@ -170,21 +241,53 @@
<example>
<title>sections imbriquées</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+
+$id = array(1001,1002,1003);
+$smarty->assign('custid',$id);
+
+$fullnames = array('John Smith','Jack Jones','Jane Munson');
+$smarty->assign('name',$fullnames);
+
+$addr = array('253 N 45th', '417 Mulberry ln', '5605 apple st');
+$smarty->assign('address',$addr);
+
+$types = array(
+ array( 'home phone', 'cell phone', 'e-mail'),
+ array( 'home phone', 'web'),
+ array( 'cell phone')
+);
+$smarty->assign('contact_type', $types);
+
+$info = array(
+ array('555-555-5555', '666-555-5555', '[email protected]'),
+ array( '123-456-4', 'www.example.com'),
+ array( '0457878')
+);
+$smarty->assign('contact_info', $info);
+
+?>
+]]>
+ </programlisting>
<programlisting>
<![CDATA[
-{* Les sections peuvent être imbriquées à un nombre de niveaux illimité.
+{*
+ Les sections peuvent être imbriquées à un nombre de niveaux illimité.
Grâce aux sections imbriquées, vous pouvez accéder à des structures de données
complexes, comme des tableaux multi-dimentionnels. Dans cet exemple,
$type_contact[client] est un tableau de type de contact pour le client
- courant. *}
+ courant.
+*}
{section name=client loop=$idClient}
+<hr />
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>
{/section}
]]>
</programlisting>
@@ -193,41 +296,63 @@
</para>
<screen>
<![CDATA[
+<hr />
id: 1000<br />
nom: John Smith<br />
addresse: 253 N 45th<br />
telephone: 555-555-5555<br />
telephone portable: 555-555-5555<br />
e-mail: [email protected]<br />
-<p>
+<hr />
id: 1001<br />
nom: Jack Jones<br />
addresse: 417 Mulberry ln<br />
telephone: 555-555-5555<br />
telephone portable: 555-555-5555<br />
e-mail: [email protected]<br />
-<p>
+<hr />
id: 1002<br />
nom: Jane Munson<br />
addresse: 5605 apple st<br />
telephone: 555-555-5555<br />
telephone portable: 555-555-5555<br />
e-mail: [email protected]<br />
-<p>
+<hr />
]]>
</screen>
</example>
<example>
<title>Sections et tableaux associatifs</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+
+$data = array(
+ array('name' => 'John Smith', 'home' => '555-555-5555',
+ 'cell' => '666-555-5555', 'email' => '[email protected]'),
+ array('name' => 'Jack Jones', 'home' => '777-555-5555',
+ 'cell' => '888-555-5555', 'email' => '[email protected]'),
+ array('name' => 'Jane Munson', 'home' => '000-555-5555',
+ 'cell' => '123456', 'email' => '[email protected]')
+);
+$smarty->assign('contacts',$data);
+
+?>
+]]>
+ </programlisting>
<programlisting>
<![CDATA[
-{* Exemple d'affichage d'un tableau associatif dans une section *}
+{*
+ Exemple d'affichage d'un tableau associatif dans une section
+*}
{section name=client loop=$contacts}
+<p>
nom: {$contacts[client].name}<br />
telephone: {$contacts[client].home}<br />
portable: {$contacts[client].cell}<br />
- e-mail: {$contacts[client].email}<p>
+ e-mail: {$contacts[client].email}
+</p>
{/section}
]]>
</programlisting>
@@ -236,24 +361,62 @@
</para>
<screen>
<![CDATA[
+<p>
nom: John Smith<br />
telephone: 555-555-5555<br />
portable: 555-555-5555<br />
-e-mail: [email protected]<p>
+e-mail: [email protected]
+</p>
+<p>
nom: Jack Jones<br />
telephone: 555-555-5555<br />
portable: 555-555-5555<br />
-e-mail: [email protected]<p>
+e-mail: [email protected]
+</p>
+<p>
nom: Jane Munson<br />
telephone: 555-555-5555<br />
portable: 555-555-5555<br />
e-mail: [email protected]<p>
+</p>
]]>
</screen>
</example>
+ <para>Exemple avec une base de données (eg. en utilisant Pear ou Adodb)</para>
+ <programlisting role="php">
+<![CDATA[
+<?php
+
+$sql = 'select id, name, home, cell, email from contacts';
+$smarty->assign('contacts',$db->getAll($sql) );
+
+?>
+]]>
+ </programlisting>
+
+ <programlisting>
+<![CDATA[
+{*
+Affiche le résultat de la base de données dans un tableau
+*}
+<table>
+ <tr><th> </th><th>Name></th><th>Home</th><th>Cell</th><th>Email</th></tr>
+ {section name=co loop=$contacts}
+ <tr>
+ <td><a href="view.php?id={$contacts[co].id}">view<a></td>
+ <td>{$contacts[co].name}</td>
+ <td>{$contacts[co].home}</td>
+ <td>{$contacts[co].cell}</td>
+ <td>{$contacts[co].email}</td>
+ <tr>
+ {/section}
+</table>
+]]>
+ </programlisting>
+
<example>
- <title>sectionelse</title>
+ <title>{sectionelse}</title>
<programlisting>
<![CDATA[
{* sectionelse est exécuté s'il n'existe aucune valeur dans idClient *}
@@ -271,34 +434,37 @@
<link linkend="language.variables.smarty.loops">{$smarty.section.sectionname.varname}</link>
</para>
<para>
- NOTE: Depuis Smarty 1.5.0, la syntaxe pour les propiétés des sections
+ Depuis Smarty 1.5.0, la syntaxe pour les propriétés des sections
a été changée de {%sectionname.varname%} à
{$smarty.section.nomSection.nomVariable}. L'ancienne syntaxe est toujours
supporté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é pour afficher l'index de parcours courant, commence par
- 0 (ou l'attribut start), et s'incrémente de 1 (ou de la valeur
- de l'attribut step).
+ 0 (ou l'attribut start s'il est fourni), et s'incrémente de 1 (ou de la valeur
+ de l'attribut step s'il est fourni).
</para>
<note>
<title>Note technique</title>
<para>
Si les attributs step et start ne sont pas modifiés, alors index
- fonctionne de la même façon que <link
+ fonctionne de la même façon que <link
linkend="section.property.iteration">iteration</link>, à l'exception qu'il commence
par 0 plutôt que par 1.
</para>
</note>
<example>
- <title>propriété de section index</title>
-<programlisting>
+ <title>propriété de {section} index</title>
+ <programlisting>
<![CDATA[
+{* FYI, $custid[customer.index] et $custid[customer] sont identiques *}
+
{section name=client loop=$idClient}
-{$smarty.section.client.index} id: {$idClient[client]}<br />
+ {$smarty.section.client.index} id: {$idClient[client]}<br />
{/section}
]]>
</programlisting>
@@ -307,47 +473,22 @@
</para>
<screen>
<![CDATA[
- 0 id: 1000<br />
- 1 id: 1001<br />
- 2 id: 1002<br />
+0 id: 1000<br />
+1 id: 1001<br />
+2 id: 1002<br />
]]>
</screen>
</example>
</sect2>
+
<sect2 id="section.property.index.prev">
<title>index_prev</title>
<para>
index_prev est utilisé pour afficher l'index de parcours
précédent de la boucle. Au premier passage, il vaut -1.
</para>
- <example>
- <title>propriété de section index_prev</title>
- <programlisting>
-<![CDATA[
- {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 à été modifié<br />
- {/if}
- {/section}
-]]>
- </programlisting>
- <para>
- L'exemple ci-dessus affichera :
- </para>
- <screen>
-<![CDATA[
- 0 id: 1000<br />
- L'id du client à été modifié<br />
- 1 id: 1001<br />
- L'id du client à été modifié<br />
- 2 id: 1002<br />
- L'id du client à été modifié<br />
-]]>
- </screen>
- </example>
</sect2>
+
<sect2 id="section.property.index.next">
<title>index_next</title>
<para>
@@ -355,17 +496,37 @@
index. Dans la dernière boucle, celà reste la valeur incrémentée,
qui respecte l'attribut step si donné.
</para>
+
<example>
- <title>propriété de section index_next</title>
- <programlisting>
+ <title>propriété de {section} index_next et index_prev</title>
+ <programlisting role="php">
<![CDATA[
- {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}
+<?php
+
+$data = array(1001,1002,1003,1004,1005);
+$smarty->assign('custid',$data);
+
+?>
+]]>
+ </programlisting>
+ <programlisting>
+ <![CDATA[
+{* FYI, $custid[cus.index] et $custid[cus] sont identiques *}
+
+<table>
+ <tr>
+ <th>index</th><th>id</th>
+ <th>index_prev</th><th>prev_id</th>
+ <th>index_next</th><th>next_id</th>
+ </tr>
+ {section name=cus loop=$custid}
+ <tr>
+ <td>{$smarty.section.cus.index}</td><td>{$custid[cus]}</td>
+ <td>{$smarty.section.cus.index_prev}</td><td>{$custid[cus.index_prev]}</td>
+ <td>{$smarty.section.cus.index_next}</td><td>{$custid[cus.index_next]}</td>
+ </tr>
+ {/section}
+</table>
]]>
</programlisting>
<para>
@@ -373,16 +534,17 @@
</para>
<screen>
<![CDATA[
- 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 />
+index id index_prev prev_id index_next next_id
+0 1001 -1 1 1002
+1 1002 0 1001 2 1003
+2 1003 1 1002 3 1004
+3 1004 2 1003 4 1005
+4 1005 3 1004 5
]]>
</screen>
</example>
</sect2>
+
<sect2 id="section.property.iteration">
<title>iteration</title>
<para>
@@ -397,17 +559,25 @@
ils fonctionnent de la même façon.
</para>
<example>
- <title>propriété iteration de section</title>
+ <title>propriété iteration de {section}</title>
+ <programlisting role="php">
+<![CDATA[
+<?php
+
+// Tableau de 3000 à 3015
+$id = range(3000,3015);
+$smarty->assign('custid',$id);
+
+?>
+]]>
+ </programlisting>
<programlisting>
<![CDATA[
- {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}
+{section name=cu loop=$custid start=5 step=2}
+ iteration={$smarty.section.cu.iteration}
+ index={$smarty.section.cu.index}
+ id={$custid[cu]}<br />
+{/section}
]]>
</programlisting>
<para>
@@ -415,93 +585,84 @@
</para>
<screen>
<![CDATA[
- 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 />
+iteration=1 index=5 id=3005<br />
+iteration=2 index=7 id=3007<br />
+iteration=3 index=9 id=3009<br />
+iteration=4 index=11 id=3011<br />
+iteration=5 index=13 id=3013<br />
+iteration=6 index=15 id=3015<br />
]]>
</screen>
+ <para>
+ Cet exemple utilise la propriété iteration pour afficher
+ un block d'en-tête de tableau toutes les cinq lignes
+ (utilisez <link linkend="language.function.if">{if}</link>
+ avec l'opérateur mod).
+ </para>
+ <programlisting>
+<![CDATA[
+<table>
+ {section name=co loop=$contacts}
+ {if $smarty.section.co.iteration % 5 == 1}
+ <tr><th> </th><th>Name></th><th>Home</th><th>Cell</th><th>Email</th></tr>
+ {/if}
+ <tr>
+ <td><a href="view.php?id={$contacts[co].id}">view<a></td>
+ <td>{$contacts[co].name}</td>
+ <td>{$contacts[co].home}</td>
+ <td>{$contacts[co].cell}</td>
+ <td>{$contacts[co].email}</td>
+ <tr>
+ {/section}
+</table>
+]]>
+ </programlisting>
</example>
</sect2>
+
<sect2 id="section.property.first">
<title>first</title>
<para>
first est à true lorsque la section est parcouru pour la première fois.
</para>
- <example>
- <title>propriété first de la section</title>
- <programlisting>
-<![CDATA[
- {section name=client loop=$idClient}
- {if $smarty.section.client.first}
- <table>
- {/if}
-
- <tr><td>{$smarty.section.client.index} id:
- {$idClient[client]}</td></tr>
-
- {if $smarty.section.client.last}
- </table>
- {/if}
- {/section}
-]]>
- </programlisting>
- <para>
- L'exemple ci-dessus affichera :
- </para>
- <screen>
-<![CDATA[
- <table>
- <tr><td>0 id: 1000</td></tr>
- <tr><td>1 id: 1001</td></tr>
- <tr><td>2 id: 1002</td></tr>
- </table>
-]]>
- </screen>
- </example>
</sect2>
+
<sect2 id="section.property.last">
<title>last</title>
<para>
last est à true lorsque la section est parcourue pour la dernière fois.
</para>
<example>
- <title>Propriété last de section</title>
- <programlisting>
-<![CDATA[
- {section name=client loop=$idClient}
- {if $smarty.section.client.first}
- <table>
- {/if}
-
- <tr><td>{$smarty.section.client.index} id:
- {$idClient[client]}</td></tr>
-
- {if $smarty.section.client.last}
- </table>
- {/if}
- {/section}
-]]>
- </programlisting>
+ <title>Propriété last et first de {section}</title>
<para>
- L'exemple ci-dessus affichera :
+ Cet exemple boucle le tableau $customers ;
+ affiche un block d'en-tête lors de la première itération et,
+ à la dernière, affiche un block de pied de page
+ (utilisation de la propriété <link linkend="section.property.total">total</link>)
</para>
- <screen>
+ <programlisting>
<![CDATA[
- <table>
- <tr><td>0 id: 1000</td></tr>
- <tr><td>1 id: 1001</td></tr>
- <tr><td>2 id: 1002</td></tr>
- </table>
+{section name=customer loop=$customers}
+{if $smarty.section.customer.first}
+<table>
+ <tr><th>id</th><th>customer</th></tr>
+ {/if}
+
+ <tr>
+ <td>{$customers[customer].id}}</td>
+ <td>{$customers[customer].name}</td>
+ </tr>
+
+ {if $smarty.section.customer.last}
+ <tr><td></td><td>{$smarty.section.customer.total} customers</td></tr>
+</table>
+{/if}
+{/section}
]]>
- </screen>
+ </programlisting>
</example>
</sect2>
+
<sect2 id="section.property.rownum">
<title>rownum</title>
<para>
@@ -510,27 +671,8 @@
linkend="section.property.iteration">iteration</link>, ils fonctionnent de façon
identique.
</para>
- <example>
- <title>propriété rownum de section</title>
-<programlisting>
-<![CDATA[
- {section name=client loop=$idClient}
- {$smarty.section.client.rownum} id: {$idClient[client]}<br />
- {/section}
-]]>
- </programlisting>
- <para>
- L'exemple ci-dessus affichera :
- </para>
- <screen>
-<![CDATA[
- 1 id: 1000<br />
- 2 id: 1001<br />
- 3 id: 1002<br />
-]]>
- </screen>
- </example>
</sect2>
+
<sect2 id="section.property.loop">
<title>loop</title>
<para>
@@ -538,14 +680,14 @@
section a utilisé. Peut être utilisé dans ou en dehors de la section.
</para>
<example>
- <title>Propriété de section index</title>
-<programlisting>
+ <title>Propriété de {section} index</title>
+ <programlisting>
<![CDATA[
- {section name=client loop=$idClient}
+{section name=client loop=$idClient}
{$smarty.section.client.index} id: {$idClient[client]}<br />
- {/section}
+{/section}
- Il y eu {$smarty.section.client.loop} clients d'affichés.
+Il y eu {$smarty.section.client.loop} clients d'affichés.
]]>
</programlisting>
<para>
@@ -553,38 +695,41 @@
</para>
<screen>
<![CDATA[
- 0 id: 1000<br />
- 1 id: 1001<br />
- 2 id: 1002<br />
+0 id: 1000<br />
+1 id: 1001<br />
+2 id: 1002<br />
- il y eu 3 clients d'affichés.
+Il y eu 3 clients d'affichés.
]]>
</screen>
</example>
</sect2>
+
<sect2 id="section.property.show">
<title>show</title>
<para>
<emphasis>show</emphasis> est utilisé comme paramètre de section.
<emphasis>show</emphasis> est une valeur booléenne, true ou false.
Si show est à "false", la section ne sera pas affichée. Si un
- sectionelse est présent, elle sera affiché.
+ {sectionelse} est présent, elle sera affichée.
</para>
<example>
- <title>section, attribut show</title>
+ <title>{section}, attribut show</title>
<programlisting>
<![CDATA[
- {* $show_client_info a pu être passé 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}
+{*
+ $show_client_info a pu être passé 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}
+{/section}
- {if $smarty.section.client.show}
- la section à été affichée.
- {else}
- la section n'a pas été affichée.
- {/if}
+{if $smarty.section.client.show}
+ la section a été affichée.
+{else}
+ la section n'a pas été affichée.
+{/if}
]]>
</programlisting>
<para>
@@ -592,30 +737,31 @@
</para>
<screen>
<![CDATA[
- 1 id: 1000<br />
- 2 id: 1001<br />
- 3 id: 1002<br />
+1 id: 1000<br />
+2 id: 1001<br />
+3 id: 1002<br />
- la section à été affichée.
+la section a été affichée.
]]>
</screen>
</example>
</sect2>
+
<sect2 id="section.property.total">
<title>total</title>
<para>
- total est utilisé pour afficher le nombre d'itération que la section
+ <literal>total</literal> est utilisé pour afficher le nombre d'itération que la section
va exécuter. Peut être utilisé dans ou en dehors de la section.
</para>
<example>
- <title>section, propriété total</title>
+ <title>{section}, propriété <literal>total</literal></title>
<programlisting>
<![CDATA[
- {section name=client loop=$idClient step=2}
- {$smarty.section.client.index} id: {$idClient[client]}<br />
- {/section}
+{section name=client loop=$idClient step=2}
+ {$smarty.section.client.index} id: {$idClient[client]}<br />
+{/section}
- Il y eu {$smarty.section.client.total} clients affichés.
+Il y eu {$smarty.section.client.total} clients affichés.
]]>
</programlisting>
<para>
@@ -623,21 +769,22 @@
</para>
<screen>
<![CDATA[
- 0 id: 1000<br />
- 2 id: 1001<br />
- 4 id: 1002<br />
+0 id: 1000<br />
+2 id: 1001<br />
+4 id: 1002<br />
- Il y eu 3 clients affichés.
+Il y eu 3 clients affichés.
]]>
</screen>
</example>
<para>
- Voir aussi
+ Voir aussi
<link linkend="language.function.foreach">{foreach}</link> et
<link linkend="language.variables.smarty.loops">$smarty.section</link>.
</para>
</sect2>
</sect1>
+
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
@@ -657,4 +804,4 @@
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
--->
+-->
\ No newline at end of file
http://cvs.php.net/diff.php/smarty/docs/fr/designers/language-builtin-functions/language-function-strip.xml?r1=1.5&r2=1.6&ty=u
Index: smarty/docs/fr/designers/language-builtin-functions/language-function-strip.xml
diff -u smarty/docs/fr/designers/language-builtin-functions/language-function-strip.xml:1.5 smarty/docs/fr/designers/language-builtin-functions/language-function-strip.xml:1.6
--- smarty/docs/fr/designers/language-builtin-functions/language-function-strip.xml:1.5 Tue May 10 17:15:40 2005
+++ smarty/docs/fr/designers/language-builtin-functions/language-function-strip.xml Sat Dec 10 17:09:36 2005
@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.5 $ -->
-<!-- EN-Revision: 1.4 Maintainer: gerlad Status: ready -->
+<!-- $Revision: 1.6 $ -->
+<!-- EN-Revision: 1.8 Maintainer: yannick Status: ready -->
+
<sect1 id="language.function.strip">
- <title>strip</title>
+ <title>{strip}</title>
<para>
Il est fréquent que les designers web rencontrent des problèmes
dus aux espaces et retours chariots, qui affectent le rendu HTML
@@ -13,7 +14,7 @@
<para>
Tout contenu situé entre les balises {strip}{/strip} se verra
allégé des espaces superflus et des retours chariots en début ou en fin
- de ligne, avant qu'il ne soit affichés. De la sorte, vous pouvez
+ de ligne, avant qu'il ne soit affiché. De la sorte, vous pouvez
conserver vos templates lisibles, sans vous soucier des effets
indésirables que peuvent apporter les espaces superflus.
</para>
@@ -21,8 +22,8 @@
<title>Note technique</title>
<para>
{strip}{/strip} n'affecte en aucun cas le contenu des variables de
- template. Voir le <link linkend="language.modifier.strip">modificateur
- strip</link> pour un rendu identique pour les variables.
+ template. Voir aussi le <link linkend="language.modifier.strip">modificateur
+ strip</link> pour un rendu identique pour les variables.
</para>
</note>
<example>
@@ -31,12 +32,12 @@
<![CDATA[
{* la suite sera affichée sur une seule ligne *}
{strip}
-<table border=0>
+<table border='0'>
<tr>
<td>
- <A HREF="{$url}">
+ <a href="{$url}">
<font color="red">Un test</font>
- </A>
+ </a>
</td>
</tr>
</table>
@@ -48,7 +49,7 @@
</para>
<screen>
<![CDATA[
-<table border=0><tr><td><A HREF="http://mon.example.com"><font color="red">Un test</font></A></td></tr></table>
+<table border='0'><tr><td><a href="http://mon.example.com"><font color="red">Un test</font></a></td></tr></table>
]]>
</screen>
</example>
@@ -59,7 +60,12 @@
au suivant/précédent et risque de ne pas être affiché selon
l'effet désiré.
</para>
+ <para>
+ Voir aussi
+ le <link linkend="language.modifier.strip">modificateur strip</link>.
+ </para>
</sect1>
+
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
@@ -79,4 +85,4 @@
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
--->
+-->
\ No newline at end of file
http://cvs.php.net/diff.php/smarty/docs/fr/designers/language-variables/language-assigned-variables.xml?r1=1.7&r2=1.8&ty=u
Index: smarty/docs/fr/designers/language-variables/language-assigned-variables.xml
diff -u smarty/docs/fr/designers/language-variables/language-assigned-variables.xml:1.7 smarty/docs/fr/designers/language-variables/language-assigned-variables.xml:1.8
--- smarty/docs/fr/designers/language-variables/language-assigned-variables.xml:1.7 Tue May 24 18:13:50 2005
+++ smarty/docs/fr/designers/language-variables/language-assigned-variables.xml Sat Dec 10 17:09:38 2005
@@ -1,10 +1,11 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.7 $ -->
-<!-- EN-Revision: 1.3 Maintainer: gerald Status: ready -->
+<!-- $Revision: 1.8 $ -->
+<!-- EN-Revision: 1.7 Maintainer: yannick Status: ready -->
+
<sect1 id="language.assigned.variables">
<title>Variables assignées depuis PHP</title>
<para>
- Pour utiliser une variables assignées depuis PHP, il
+ Pour utiliser une variables <link linkend="api.assign">assignées</link> depuis PHP, il
faut la préfixer par le symbole dollar <literal>$</literal>.
Les variables asignées depuis un template grâce à la fonction
<link linkend="language.function.assign">{assign}</link> sont
@@ -12,21 +13,44 @@
</para>
<example>
<title>Variables assignées</title>
- <programlisting>
+ <para>Script PHP</para>
+ <programlisting role="php">
<![CDATA[
-Bienvenue {$prenom}, heureux de voir que tu es arrivé ici.
-<p>
-La dernière connexion remonte au {$dateConnexionPrecedente}.
+<?php
+
+$smarty = new Smarty;
+
+$smarty->assign('firstname', 'Doug');
+$smarty->assign('lastname', 'Evans');
+$smarty->assign('meetingPlace', 'New York');
+
+$smarty->display('index.tpl');
+
+?>
]]>
- </programlisting>
- <para>
- Celà va afficher:
- </para>
+ </programlisting>
+ <para>
+ où index.tpl est :
+ </para>
+ <programlisting>
+<![CDATA[
+Bonjour {$firstname} {$lastname}, heureux de voir que tu es arrivé ici.
+<br />
+{* ceci ne fonctionnera pas car $vars est sensible à la casse *}
+Cette semaine, le meeting est à {$meetingplace}.
+{* ceci fonctionnera *}
+Cette semaine, le meeting est à {$meetingPlace}.
+]]>
+ </programlisting>
+ <para>
+ Celà va afficher:
+ </para>
<screen>
<![CDATA[
Bienvenue Doug, heureux de voir que tu es arrivé ici.
-<p>
-La dernière connexion remonte au 11 janvier 2001.
+<br />
+Cette semaine, le meeting est à .
+Cette semaine, le meeting est à New York.
]]>
</screen>
</example>
@@ -44,12 +68,13 @@
<![CDATA[
<?php
-$smarty = new Smarty;
$smarty->assign('Contacts',
array('fax' => '555-222-9876',
- 'email' => '[email protected]',
+ 'email' => '[email protected]',
'phone' => array('home' => '555-444-3333',
- 'cell' => '555-111-1234')));
+ 'cell' => '555-111-1234')
+ )
+ );
$smarty->display('index.tpl');
?>
]]>
@@ -72,7 +97,7 @@
<screen>
<![CDATA[
555-222-9876<br />
[email protected]<br />
[email protected]<br />
555-444-3333<br />
555-111-1234<br />
]]>
@@ -91,12 +116,12 @@
<programlisting role="php">
<![CDATA[
<?php
-$smarty = new Smarty;
-$smarty->assign('Contacts',
- array('555-222-9876',
- '[email protected]',
- array('555-444-3333',
- '555-111-1234')));
+$smarty->assign('Contacts', array(
+ '555-222-9876',
+ '[email protected]',
+ array('555-444-3333',
+ '555-111-1234')
+ ));
$smarty->display('index.tpl');
?>
]]>
@@ -119,7 +144,7 @@
<screen>
<![CDATA[
555-222-9876<br />
[email protected]<br />
[email protected]<br />
555-444-3333<br />
555-111-1234<br />
]]>
@@ -142,12 +167,12 @@
]]>
</programlisting>
<para>
- Ce qui donne en sortie :
+ Ce qui donne en sortie :
</para>
<screen>
<![CDATA[
nom: Zaphod Beeblebrox<br />
-email: [email protected]<br />
+email: [email protected]<br />
]]>
</screen>
</example>
http://cvs.php.net/diff.php/smarty/docs/fr/designers/language-variables/language-config-variables.xml?r1=1.4&r2=1.5&ty=u
Index: smarty/docs/fr/designers/language-variables/language-config-variables.xml
diff -u smarty/docs/fr/designers/language-variables/language-config-variables.xml:1.4 smarty/docs/fr/designers/language-variables/language-config-variables.xml:1.5
--- smarty/docs/fr/designers/language-variables/language-config-variables.xml:1.4 Tue May 24 18:13:50 2005
+++ smarty/docs/fr/designers/language-variables/language-config-variables.xml Sat Dec 10 17:09:38 2005
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.4 $ -->
-<!-- EN-Revision: 1.3 Maintainer: gerald Status: ready -->
+<!-- $Revision: 1.5 $ -->
+<!-- EN-Revision: 1.4 Maintainer: yannick Status: ready -->
+
<sect1 id="language.config.variables">
<title>Variables chargées depuis des fichiers de configuration</title>
<para>
@@ -93,6 +94,17 @@
<link linkend="language.syntax.variables">variables</link> et les
<link linkend="language.variables.smarty">variables réservées $smarty</link>.
</para>
+ <para>
+ Les variables des fichiers de configuration ne peuvent pas être utilisées
+ tant qu'elles n'ont pas été chargées depuis un fichier de configuration. Cette procédure
+ est expliqué plus loin dans cette documentation sous la section
+ <link linkend="language.function.config.load"><command>{config_load}</command></link>.
+ </para>
+ <para>
+ Voir aussi
+ les <link linkend="language.syntax.variables">variables</link> et
+ les <link linkend="language.variables.smarty">variables réservées $smarty</link>.
+</para>
</sect1>
<!-- Keep this comment at the end of the file
http://cvs.php.net/diff.php/smarty/docs/fr/designers/language-variables/language-variables-smarty.xml?r1=1.9&r2=1.10&ty=u
Index: smarty/docs/fr/designers/language-variables/language-variables-smarty.xml
diff -u smarty/docs/fr/designers/language-variables/language-variables-smarty.xml:1.9 smarty/docs/fr/designers/language-variables/language-variables-smarty.xml:1.10
--- smarty/docs/fr/designers/language-variables/language-variables-smarty.xml:1.9 Tue May 24 18:13:50 2005
+++ smarty/docs/fr/designers/language-variables/language-variables-smarty.xml Sat Dec 10 17:09:38 2005
@@ -1,39 +1,43 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.9 $ -->
-<!-- EN-Revision: 1.8 Maintainer: gerald Status: ready -->
+<!-- $Revision: 1.10 $ -->
+<!-- EN-Revision: 1.12 Maintainer: yannick Status: ready -->
+
<sect1 id="language.variables.smarty">
<title>Variable réservée {$smarty}</title>
<para>
- La variable réservée {$smarty} peut être utilisée pour accéder à plusieurs
+ La variable PHP réservée {$smarty} peut être utilisée pour accéder à plusieurs
variables spéciales du template. En voici la liste complète.
</para>
<sect2 id="language.variables.smarty.request">
<title>Variables de requête</title>
<para>
- Les variables de requête comme GET, POST, COOKIES, SERVER, ENVIRONNEMENT
- et SESSION peuvent être utilisées comme dans l'exemple suivant:
+ Les <ulink url="&url.php-manual;reserved.variables">variables de requête</ulink>
+ comme $_GET, $_POST, $_COOKIE, $_SERVER, $_ENV and $_SESSION
+ (voir <link linkend="variable.request.vars.order">$request_vars_order</link>
+ et <link linkend="variable.request.use.auto.globals">$request_use_auto_globals</link>)
+ peuvent être utilisées comme dans l'exemple suivant:
</para>
<example>
<title>Afficher des variables de requête</title>
<programlisting>
<![CDATA[
-{* Affiche la valeur de page dans l'url (GET) http://www.example.com/index.php?page=foo *}
+{* Affiche la valeur de page dans l'url ($_GET) http://www.example.com/index.php?page=foo *}
{$smarty.get.page}
-{* affiche la variable "page" récupérée depuis un formulaire (POST) *}
+{* affiche la variable "page" récupérée depuis un formulaire ($_POST['page']) *}
{$smarty.post.page}
-{* affiche la valeur du cookie "utilisateur" *}
+{* affiche la valeur du cookie "utilisateur" ($_COOKIE['username']) *}
{$smarty.cookies.utilisateur}
-{* affiche la variable serveur "SERVER_NAME" *}
+{* affiche la variable serveur "SERVER_NAME" ($_SERVER['SERVER_NAME']) *}
{$smarty.server.SERVER_NAME}
{* affiche la variable d'environnement "PATH" *}
{$smarty.env.PATH}
-{* affiche la variable de session PHP "id" *}
+{* affiche la variable de session PHP "id" ($_SESSION['id']) *}
{$smarty.session.id}
{* affiche la variable "utilisateur" du regroupement de get/post/cookies/server/env *}
@@ -41,19 +45,27 @@
]]>
</programlisting>
</example>
+ <note>
+ <para>
+ Pour des raisons historiques, {$SCRIPT_NAME} peut être accédé
+ directement, cependant, {$smarty.server.SCRIPT_NAME} est
+ la solution proposée pour accéder à cette valeur.
+ </para>
+ </note>
</sect2>
<sect2 id="language.variables.smarty.now">
<title>{$smarty.now}</title>
<para>
- Le timestamp courant peut être récupéré grâce à {$smarty.now}.
+ Le <ulink url="&url.php-manual;function.time">timestamp</ulink>
+ courant peut être récupéré grâce à {$smarty.now}.
Le nombre obtenu correspond au nombre de secondes écoulées depuis
Epoch (1 Janvier 1970) et peut être passé directement au modificateur
de variable date <link linkend="language.modifier.date.format">date_format</link>
à des fins d'affichage.
</para>
<example>
- <title>utilisation de {$smarty.now}</title>
+ <title>Utilisation de {$smarty.now}</title>
<programlisting>
<![CDATA[
{* utilise le modificateur de variable date_format pour afficher la date et heure *}
@@ -62,12 +74,12 @@
</programlisting>
</example>
</sect2>
+
<sect2 id="language.variables.smarty.const">
<title>{$smarty.const}</title>
<para>
Vous pouvez directement accéder aux constantes PHP.
- Voir aussi les <link
- linkend="smarty.constants">constantes smarty</link>.
+ Voir aussi les <link linkend="smarty.constants">constantes smarty</link>.
</para>
<example>
<title>Utiliser {$smarty.const}</title>
@@ -82,7 +94,7 @@
<sect2 id="language.variables.smarty.capture">
<title>{$smarty.capture}</title>
<para>
- La capture réalisée via
+ La capture réalisée via
<link linkend="language.function.capture">{capture}..{/capture}</link>
peut être récupérée par l'intermédiaire de la variable {$smarty}. Voir la section
sur <link linkend="language.function.capture">{capture}</link> pour un
@@ -93,11 +105,10 @@
<sect2 id="language.variables.smarty.config">
<title>{$smarty.config}</title>
<para>
- La variable {$smarty} peut être utilisée pour désigner une <link
- linkend="language.config.variables">variable
- d'un fichier de configuration</link>. {$smarty.config.foo} est un synonyme de
- {#foo#}. Voir la section <link
- linkend="language.function.config.load">{config_load}</link>
+ La variable {$smarty} peut être utilisée pour désigner une
+ <link linkend="language.config.variables">variable d'un fichier de configuration</link>.
+ {$smarty.config.foo} est un synonyme de {#foo#}. Voir la section
+ <link linkend="language.function.config.load">{config_load}</link>
pour un exemple à ce sujet.
</para>
</sect2>
@@ -118,17 +129,24 @@
Cette variable contient le nom du template en cours de traitement.
</para>
</sect2>
+
+ <sect2 id="language.variables.smarty.version">
+ <title>{$smarty.version}</title>
+ <para>
+ Cette variable contient la version de Smarty utilisée pour compiler un template.
+ </para>
+ </sect2>
+
<sect2 id="language.variables.smarty.ldelim">
<title>{$smarty.ldelim}, {$smarty.rdelim}</title>
<para>
Cette variable est utilisée pour afficher le délémiteur gauche et le délimiteur droit. Lisez aussi
- la partie <link
- linkend="language.function.ldelim">{ldelim},{rdelim}</link>.
+ la partie <link linkend="language.function.ldelim">{ldelim},{rdelim}</link>.
</para>
<para>
- Voir aussi les
- <link linkend="language.syntax.variables">variables</link> et les
- <link linkend="language.config.variables">variables de configuration</link>.
+ Voir aussi
+ les <link linkend="language.syntax.variables">variables</link> et
+ les <link linkend="language.config.variables">variables de configuration</link>.
</para>
</sect2>
</sect1>
http://cvs.php.net/diff.php/smarty/docs/fr/getting-started.xml?r1=1.11&r2=1.12&ty=u
Index: smarty/docs/fr/getting-started.xml
diff -u smarty/docs/fr/getting-started.xml:1.11 smarty/docs/fr/getting-started.xml:1.12
--- smarty/docs/fr/getting-started.xml:1.11 Sun Jul 10 15:27:50 2005
+++ smarty/docs/fr/getting-started.xml Sat Dec 10 17:09:38 2005
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.11 $ -->
-<!-- EN-Revision: 1.10 Maintainer: didou Status: ready -->
+<!-- $Revision: 1.12 $ -->
+<!-- EN-Revision: 1.13 Maintainer: yannick Status: ready -->
+
<part id="getting.started">
<title>Pour commencer</title>
@@ -155,7 +156,7 @@
<sect1 id="installing.smarty.basic">
<title>Installation de base</title>
<para>
- Copiez les fichiers bibliothèques de Smarty du répertoire
+ Copiez les fichiers bibliothèques de Smarty du sous-dossier
/libs/ de la distribution à un emplacement accessible à PHP.
Ce sont des fichiers PHP que vous NE DEVEZ PAS
modifier. Ils sont partagés par toutes les applications et ne seront
@@ -177,18 +178,18 @@
</example>
<para>
- Smarty utilise une constante PHP appelée <link
+ Smarty utilise une <ulink url="&url.php-manual;define">constante</ulink> PHP appelée <link
linkend="constant.smarty.dir">SMARTY_DIR</link> qui
- représente le chemin complet de la bibliothèque Smarty. En fait,
+ représente le <emphasis role="bold">chemin complet</emphasis> de la bibliothèque Smarty. En fait,
si votre application trouve le fichier
<filename>Smarty.class.php</filename>, vous n'aurez pas
- besoin de définir la variable <link linkend="constant.smarty.dir">SMARTY_DIR</link>,
+ besoin de définir la variable <link linkend="constant.smarty.dir">SMARTY_DIR</link>,
Smarty s'en chargera pour vous.
En revanche, si <filename>Smarty.class.php</filename>
n'est pas dans votre répertoire d'inclusion ou que vous ne
donnez pas un chemin absolu à votre application, vous
devez définir SMARTY_DIR explicitement. SMARTY_DIR
- <emphasis>doit</emphasis> avoir être terminé par un slash.
+ <emphasis role="bold">doit</emphasis> avoir être terminé par un slash.
</para>
<para>
@@ -200,8 +201,9 @@
<programlisting role="php">
<![CDATA[
<?php
-require('Smarty.class.php');
-$smarty = new Smarty;
+// Note : Smarty a un 'S' majuscule
+require_once('Smarty.class.php');
+$smarty = new Smarty();
?>
]]>
</programlisting>
@@ -214,40 +216,50 @@
</para>
<example>
- <title>fournir un chemin absolu vers la bibliothèque Smarty</title>
+ <title>Définition manuelle de la constante SMARTY_DIR</title>
<programlisting role="php">
<![CDATA[
<?php
-require('/usr/local/lib/php/Smarty/Smarty.class.php');
-$smarty = new Smarty;
+// Style *nix (notez le 'S' majuscule)
+define('SMARTY_DIR', '/usr/local/lib/php/Smarty-v.e.r/libs/');
+
+// Style Windows
+define('SMARTY_DIR', 'c:/webroot/libs/Smarty-v.e.r/libs/');
+
+require_once(SMARTY_DIR . 'Smarty.class.php');
+$smarty = new Smarty();
?>
]]>
</programlisting>
</example>
<example>
- <title>Ajouter le répertoire de la bibliothèque dans l'include_path de PHP</title>
+ <title>Définir le chemin absolu au fichier de la bibliothèque</title>
<programlisting role="php">
<![CDATA[
<?php
-// Editez votre fichier php.ini file, ajoutez le chemin de la
-// bibliothèque Smarty et redémarrez les serveur web.
-// la ligne suivante doit alors fonctionner :
-require('Smarty.class.php');
-$smarty = new Smarty;
+// Style *nix (notez le 'S' majuscule)
+require_once('/usr/local/lib/php/Smarty-v.e.r/libs/Smarty.class.php');
+
+// Style Windows
+require_once('c:/webroot/libs/Smarty-v.e.r/libs/Smarty.class.php');
+
+$smarty = new Smarty();
?>
]]>
</programlisting>
</example>
<example>
- <title>Définir explicitement la constante SMARTY_DIR</title>
+ <title>Ajout du dossier contenant la bibliothèque à l'include_path de PHP</title>
<programlisting role="php">
<![CDATA[
<?php
-define('SMARTY_DIR', '/usr/local/lib/php/Smarty/');
-require(SMARTY_DIR . 'Smarty.class.php');
-$smarty = new Smarty;
+// Editez votre fichier php.ini, ajoutez le dossier contenant la
+// bibliothèque Smarty à l'include_path et redémarrez le serveur web.
+// Puis, ce qui suit devrait fonctionner :
+require_once('Smarty.class.php');
+$smarty = new Smarty();
?>
]]>
</programlisting>
@@ -258,7 +270,7 @@
il est temps de définir les répertoires de Smarty, pour votre application.
</para>
<para>
- Smarty a besoin de quatre répertoires qui sont (par défaut)
+ Smarty a besoin de quatre répertoires qui sont, par défaut,
<filename class="directory">'templates/'</filename>,
<filename class="directory">'templates_c/'</filename>,
<filename class="directory">'configs/'</filename> et
@@ -332,19 +344,19 @@
<title>Exemple de structure de fichiers</title>
<screen>
<![CDATA[
-/usr/local/lib/php/Smarty/Smarty.class.php
-/usr/local/lib/php/Smarty/Smarty_Compiler.class.php
-/usr/local/lib/php/Smarty/Config_File.class.php
-/usr/local/lib/php/Smarty/debug.tpl
-/usr/local/lib/php/Smarty/internals/*.php
-/usr/local/lib/php/Smarty/plugins/*.php
-
-/web/www.example.com/smarty/livredor/templates/
-/web/www.example.com/smarty/livredor/templates_c/
-/web/www.example.com/smarty/livredor/configs/
-/web/www.example.com/smarty/livredor/cache/
+/usr/local/lib/php/Smarty-v.e.r/libs/Smarty.class.php
+/usr/local/lib/php/Smarty-v.e.r/libs/Smarty_Compiler.class.php
+/usr/local/lib/php/Smarty-v.e.r/libs/Config_File.class.php
+/usr/local/lib/php/Smarty-v.e.r/libs/debug.tpl
+/usr/local/lib/php/Smarty-v.e.r/libs/internals/*.php
+/usr/local/lib/php/Smarty-v.e.r/libs/plugins/*.php
+
+/web/www.example.com/smarty/guestbook/templates/
+/web/www.example.com/smarty/guestbook/templates_c/
+/web/www.example.com/smarty/guestbook/configs/
+/web/www.example.com/smarty/guestbook/cache/
-/web/www.example.com/docs/livredor/index.php
+/web/www.example.com/docs/guestbook/index.php
]]>
</screen>
</example>
@@ -389,7 +401,7 @@
<para>
Nous devons créer le fichier 'index.tpl' que Smarty va charger.
- Il va se trouver dans <link linkend="variable.template.dir">$template_dir</link>.
+ Il va se trouver dans le dossier <link linkend="variable.template.dir">$template_dir</link>.
</para>
<example>
@@ -399,7 +411,7 @@
{* Smarty *}
-Hello, {$name}!
+Bonjour, {$name}, Bienvenue dans Smarty !
]]>
</screen>
</example>
@@ -419,34 +431,32 @@
<para>
Maintenant passons à l'édition du fichier 'index.php'. Nous allons
- créer une instance de Smarty, assigner une valeur à une variable
- de template et afficher le résultat avec 'index.tpl'. Dans notre
- exemple d'environnement, "/usr/local/lib/php/Smarty" est dans notre
- include_path. Assurez-vous de faire la même chose ou d'utiliser
- des chemins absolus.
+ créer une instance de Smarty, <link linkend="api.assign">assigner</link>
+ une valeur à une variable de template et
+ <link linkend="api.display">afficher</link> le résultat avec 'index.tpl'.
</para>
<example>
<title>Édition de /web/www.example.com/docs/livredor/index.php</title>
- <screen>
+ <programlisting role="php">
<![CDATA[
<?php
- // charge la bibliothèque Smarty
- require('Smarty.class.php');
+// charge la bibliothèque Smarty
+require_once(SMARTY_DIR . 'Smarty.class.php');
- $smarty = new Smarty;
+$smarty = new Smarty();
- $smarty->template_dir = '/web/www.example.com/smarty/livredor/templates/';
- $smarty->compile_dir = '/web/www.example.com/smarty/livredor/templates_c/';
- $smarty->config_dir = '/web/www.example.com/smarty/livredor/configs/';
- $smarty->cache_dir = '/web/www.example.com/smarty/livredor/cache/';
+$smarty->template_dir = '/web/www.example.com/smarty/livredor/templates/';
+$smarty->compile_dir = '/web/www.example.com/smarty/livredor/templates_c/';
+$smarty->config_dir = '/web/www.example.com/smarty/livredor/configs/';
+$smarty->cache_dir = '/web/www.example.com/smarty/livredor/cache/';
- $smarty->assign('name','Ned');
+$smarty->assign('name','Ned');
- $smarty->display('index.tpl');
+$smarty->display('index.tpl');
?>
]]>
- </screen>
+ </programlisting>
</example>
<note>
@@ -465,7 +475,7 @@
<para>
Et maintenant appelez le fichier <filename>index.php</filename> avec navigateur
- Web. Vous devriez voir "Hello, Ned!".
+ Web. Vous devriez voir "Bonjour, Ned, Bienvenue dans Smarty !".
</para>
<para>
Vous venez de terminer l'installation de base de Smarty !