mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-05 02:44:27 +02:00
some WS and fixed a typo in the example
This commit is contained in:
@@ -1,73 +1,93 @@
|
|||||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||||
<!-- $Revision$ -->
|
<!-- $Revision$ -->
|
||||||
<sect1 id="language.assigned.variables">
|
<sect1 id="language.assigned.variables">
|
||||||
<title>Variables assign<67>es depuis PHP</title>
|
<title>Variables assign<67>es depuis PHP</title>
|
||||||
<para>
|
<para>
|
||||||
Pour utiliser une variables assign<67>es depuis PHP, il faut la pr<70>fixer par le
|
Pour utiliser une variables assign<67>es depuis PHP, il
|
||||||
symbole dollar <literal>$</literal>. Les variables asign<67>es depuis un
|
faut la pr<70>fixer par le symbole dollar <literal>$</literal>.
|
||||||
template gr<67>ce <20> la fonction <link linkend="language.function.assign">assign</link>
|
Les variables asign<67>es depuis un template gr<67>ce <20> la fonction
|
||||||
sont manipul<75>es de la m<>me fa<66>on.
|
<link linkend="language.function.assign">assign</link> sont
|
||||||
</para>
|
manipul<EFBFBD>es de la m<>me fa<66>on.
|
||||||
<example>
|
</para>
|
||||||
|
<example>
|
||||||
<title>Variables assign<67>es</title>
|
<title>Variables assign<67>es</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
|
<![CDATA[
|
||||||
Bienvenue {$prenom}, heureux de voir que tu es arriv<69> ici.
|
Bienvenue {$prenom}, heureux de voir que tu es arriv<69> ici.
|
||||||
<p>
|
<p>
|
||||||
La derni<6E>re connexion remonte au {$dateConnexionPrecedente}.
|
La derni<6E>re connexion remonte au {$dateConnexionPrecedente}.
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
|
<para>
|
||||||
|
Cela va afficher:
|
||||||
|
</para>
|
||||||
|
<screen>
|
||||||
|
<![CDATA[
|
||||||
|
Bienvenue Doug, heureux de voir que tu es arriv<69> ici.
|
||||||
|
<p>
|
||||||
|
La derni<6E>re connexion remonte au 11 janvier 2001.
|
||||||
|
]]>
|
||||||
|
</screen>
|
||||||
|
</example>
|
||||||
|
|
||||||
SORTIE:
|
<sect2 id="language.variables.assoc.arrays">
|
||||||
|
<title>Tableaux associatifs</title>
|
||||||
Bienvenue Doug, heureux de voir que tu est arriv<69> ici.
|
<para>
|
||||||
<p>
|
Vous pouvez <20>galement utiliser des variables sous forme de tableaux
|
||||||
La derni<6E>re connexion remonte au 11 janvier 2001.</programlisting>
|
associatifs assign<67>es depuis PHP en en sp<73>cifiant la clef,
|
||||||
</example>
|
apr<70>s le symbole '.' (point).
|
||||||
|
</para>
|
||||||
<sect2 id="language.variables.assoc.arrays">
|
<example>
|
||||||
<title>Tableaux associatifs</title>
|
<title>Acc<EFBFBD>der aux variables de tableaux associatifs</title>
|
||||||
<para>
|
<programlisting role="php">
|
||||||
Vous pouvez <20>galement utiliser des variables sous forme de tableaux
|
<![CDATA[
|
||||||
associatifs assign<67>es depuis PHP en en sp<73>cifiant la clef,
|
<?php
|
||||||
apr<70>s le symbole '.' (point).
|
|
||||||
</para>
|
|
||||||
<example>
|
|
||||||
<title>acc<EFBFBD>der aux variables de tableaux associatifs</title>
|
|
||||||
<programlisting>
|
|
||||||
index.php:
|
|
||||||
|
|
||||||
$smarty = new Smarty;
|
$smarty = new Smarty;
|
||||||
$smarty->assign('Contacts',
|
$smarty->assign('Contacts',
|
||||||
array('fax' => '555-222-9876',
|
array('fax' => '555-222-9876',
|
||||||
'email' => 'zaphod@slartibartfast.com',
|
'email' => 'zaphod@slartibartfast.com',
|
||||||
'phone' => array('home' => '555-444-3333',
|
'phone' => array('home' => '555-444-3333',
|
||||||
'cell' => '555-111-1234')));
|
'cell' => '555-111-1234')));
|
||||||
$smarty->display('index.tpl');
|
$smarty->display('index.tpl');
|
||||||
|
?>
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
|
<para>
|
||||||
|
o<> index.tpl est :
|
||||||
|
</para>
|
||||||
|
<programlisting>
|
||||||
|
<![CDATA[
|
||||||
|
{$Contacts.fax}<br />
|
||||||
|
{$Contacts.email}<br />
|
||||||
|
{* vous pouvez afficher des tableaux de tableaux *}
|
||||||
|
{$Contacts.phone.home}<br />
|
||||||
|
{$Contacts.phone.cell}<br />
|
||||||
|
]]>
|
||||||
|
</programlisting>
|
||||||
|
<para>
|
||||||
|
Cela va afficher :
|
||||||
|
</para>
|
||||||
|
<screen>
|
||||||
|
<![CDATA[
|
||||||
|
555-222-9876<br />
|
||||||
|
zaphod@slartibartfast.com<br />
|
||||||
|
555-444-3333<br />
|
||||||
|
555-111-1234<br />
|
||||||
|
]]>
|
||||||
|
</screen>
|
||||||
|
</example>
|
||||||
|
</sect2>
|
||||||
|
|
||||||
index.tpl:
|
<sect2 id="language.variables.array.indexes">
|
||||||
|
<title>Tableaux index<65>s</title>
|
||||||
{$Contacts.fax}<br>
|
<para>
|
||||||
{$Contacts.email}<br>
|
Vous pouvez utiliser des tableaux index<65>s de la m<>me fa<66>on
|
||||||
{* you can print arrays of arrays as well *}
|
que vous le faites en PHP.
|
||||||
{$Contacts.phone.home}<br>
|
</para>
|
||||||
{$Contacts.phone.cell}<br>
|
<example>
|
||||||
|
<title>Acc<EFBFBD>s aux tableaux gr<67>ce <20> l'index</title>
|
||||||
SORTIE:
|
<programlisting>
|
||||||
|
|
||||||
555-222-9876<br>
|
|
||||||
zaphod@slartibartfast.com<br>
|
|
||||||
555-444-3333<br>
|
|
||||||
555-111-1234<br></programlisting>
|
|
||||||
</example>
|
|
||||||
</sect2>
|
|
||||||
<sect2 id="language.variables.array.indexes">
|
|
||||||
<title>Tableaux index<65>s</title>
|
|
||||||
<para>
|
|
||||||
Vous pouvez utiliser des tableaux index<65>s de la m<>me fa<66>on que vous le
|
|
||||||
faites en PHP.
|
|
||||||
</para>
|
|
||||||
<example>
|
|
||||||
<title>Acc<EFBFBD>s aux tableaux gr<67>ce <20> l'index</title>
|
|
||||||
<programlisting>
|
|
||||||
index.php:
|
index.php:
|
||||||
|
|
||||||
$smarty = new Smarty;
|
$smarty = new Smarty;
|
||||||
@@ -93,13 +113,13 @@ zaphod@slartibartfast.com<br>
|
|||||||
555-444-3333<br>
|
555-444-3333<br>
|
||||||
555-111-1234<br></programlisting>
|
555-111-1234<br></programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect2>
|
</sect2>
|
||||||
<sect2 id="language.variables.objects">
|
<sect2 id="language.variables.objects">
|
||||||
<title>Objets</title>
|
<title>Objets</title>
|
||||||
<para>
|
<para>
|
||||||
Les attributs des objets assign<67>s depuis PHP peuvent <20>tre utilis<69>es en
|
Les attributs des objets assign<67>s depuis PHP peuvent <20>tre utilis<69>es en
|
||||||
en sp<73>cifiant le nom apr<70>s le symbole '->'.
|
en sp<73>cifiant le nom apr<70>s le symbole '->'.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>acc<EFBFBD>der aux attributs des objets</title>
|
<title>acc<EFBFBD>der aux attributs des objets</title>
|
||||||
<programlisting>
|
<programlisting>
|
||||||
@@ -111,7 +131,7 @@ SORTIE:
|
|||||||
nom: Zaphod Beeblebrox<br>
|
nom: Zaphod Beeblebrox<br>
|
||||||
email: zaphod@slartibartfast.com<br></programlisting>
|
email: zaphod@slartibartfast.com<br></programlisting>
|
||||||
</example>
|
</example>
|
||||||
</sect2>
|
</sect2>
|
||||||
</sect1>
|
</sect1>
|
||||||
<!-- Keep this comment at the end of the file
|
<!-- Keep this comment at the end of the file
|
||||||
Local variables:
|
Local variables:
|
||||||
|
Reference in New Issue
Block a user