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:
@@ -3,24 +3,31 @@
|
|||||||
<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
|
||||||
|
manipul<75>es de la m<>me fa<66>on.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<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}.
|
||||||
|
]]>
|
||||||
SORTIE:
|
</programlisting>
|
||||||
|
<para>
|
||||||
Bienvenue Doug, heureux de voir que tu est arriv<69> ici.
|
Cela va afficher:
|
||||||
<p>
|
</para>
|
||||||
La derni<6E>re connexion remonte au 11 janvier 2001.</programlisting>
|
<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>
|
</example>
|
||||||
|
|
||||||
<sect2 id="language.variables.assoc.arrays">
|
<sect2 id="language.variables.assoc.arrays">
|
||||||
@@ -31,39 +38,52 @@ La derni
|
|||||||
apr<70>s le symbole '.' (point).
|
apr<70>s le symbole '.' (point).
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>acc<EFBFBD>der aux variables de tableaux associatifs</title>
|
<title>Acc<EFBFBD>der aux variables de tableaux associatifs</title>
|
||||||
<programlisting>
|
<programlisting role="php">
|
||||||
index.php:
|
<![CDATA[
|
||||||
|
<?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');
|
||||||
|
?>
|
||||||
index.tpl:
|
]]>
|
||||||
|
</programlisting>
|
||||||
{$Contacts.fax}<br>
|
<para>
|
||||||
{$Contacts.email}<br>
|
o<> index.tpl est :
|
||||||
{* you can print arrays of arrays as well *}
|
</para>
|
||||||
{$Contacts.phone.home}<br>
|
<programlisting>
|
||||||
{$Contacts.phone.cell}<br>
|
<![CDATA[
|
||||||
|
{$Contacts.fax}<br />
|
||||||
SORTIE:
|
{$Contacts.email}<br />
|
||||||
|
{* vous pouvez afficher des tableaux de tableaux *}
|
||||||
555-222-9876<br>
|
{$Contacts.phone.home}<br />
|
||||||
zaphod@slartibartfast.com<br>
|
{$Contacts.phone.cell}<br />
|
||||||
555-444-3333<br>
|
]]>
|
||||||
555-111-1234<br></programlisting>
|
</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>
|
</example>
|
||||||
</sect2>
|
</sect2>
|
||||||
|
|
||||||
<sect2 id="language.variables.array.indexes">
|
<sect2 id="language.variables.array.indexes">
|
||||||
<title>Tableaux index<65>s</title>
|
<title>Tableaux index<65>s</title>
|
||||||
<para>
|
<para>
|
||||||
Vous pouvez utiliser des tableaux index<65>s de la m<>me fa<66>on que vous le
|
Vous pouvez utiliser des tableaux index<65>s de la m<>me fa<66>on
|
||||||
faites en PHP.
|
que vous le faites en PHP.
|
||||||
</para>
|
</para>
|
||||||
<example>
|
<example>
|
||||||
<title>Acc<EFBFBD>s aux tableaux gr<67>ce <20> l'index</title>
|
<title>Acc<EFBFBD>s aux tableaux gr<67>ce <20> l'index</title>
|
||||||
|
Reference in New Issue
Block a user