mirror of
https://github.com/smarty-php/smarty.git
synced 2025-11-02 21:31:48 +01:00
sync with EN
This commit is contained in:
@@ -1,13 +1,14 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<!-- EN-Revision: 1.4 Maintainer: yannick Status: ready -->
|
||||
<!-- EN-Revision: 1.6 Maintainer: yannick Status: ready -->
|
||||
|
||||
<refentry id="api.assign">
|
||||
<refnamediv>
|
||||
<refname>assign</refname>
|
||||
<refpurpose></refpurpose>
|
||||
<refname>assign()</refname>
|
||||
<refpurpose>Assigne des valeurs au template</refpurpose>
|
||||
</refnamediv>
|
||||
<refsect1>
|
||||
<title />
|
||||
<title>Description</title>
|
||||
<methodsynopsis>
|
||||
<type>void</type><methodname>assign</methodname>
|
||||
<methodparam><type>mixed</type><parameter>var</parameter></methodparam>
|
||||
@@ -18,12 +19,11 @@
|
||||
<methodparam><type>mixed</type><parameter>var</parameter></methodparam>
|
||||
</methodsynopsis>
|
||||
<para>
|
||||
Utilis<EFBFBD>e pour assigner des valeurs aux templates. Vous pouvez
|
||||
explicitement passer des paires nom/valeur, ou des tableaux
|
||||
associatifs contenant des paires nom/valeur.
|
||||
Vous pouvez explicitement passer des paires nom/valeur, ou
|
||||
des tableaux associatifs contenant des paires nom/valeur.
|
||||
</para>
|
||||
<example>
|
||||
<title>Exemple avec assign</title>
|
||||
<title>Exemple avec assign()</title>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
@@ -33,20 +33,44 @@ $smarty->assign("Adresse",$address);
|
||||
|
||||
// passe un tableau associatif
|
||||
$smarty->assign(array('Ville' => 'Lincoln','Pays' => 'Nebraska'));
|
||||
|
||||
// Passe une ligne d'une base de donn<6E>es (eg adodb)
|
||||
$sql = 'select id, name, email from contacts where contact ='.$id;
|
||||
$smarty->assign('contact', $db->getRow($sql));
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
<para>
|
||||
Acc<63>der <20> cela dans un template avec
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{* notez que les variables sont sensibles <20> la casse, comme en PHP *}
|
||||
{$Name}
|
||||
{$Address}
|
||||
{$city}
|
||||
{$state}
|
||||
|
||||
{$contact.id}, {$contact.name},{$contact.email}
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
<para>
|
||||
Voir aussi
|
||||
Pour des assignements plus complexes de tableaux, lisez
|
||||
<link linkend="language.function.foreach">{foreach}</link> et
|
||||
<link linkend="language.function.section">{section}</link>.
|
||||
</para>
|
||||
<para>
|
||||
Voir aussi
|
||||
<link linkend="api.assign.by.ref">assign_by_ref()</link>,
|
||||
<link linkend="api.get.template.vars">get_template_vars()</link>,
|
||||
<link linkend="api.clear.assign">clear_assign()</link>,
|
||||
<link linkend="api.append">append()</link>,
|
||||
<link linkend="language.function.assign">{assign}</link> et
|
||||
<link linkend="api.get.template.vars">get_template_vars()</link>.
|
||||
</para>
|
||||
<link linkend="api.append">append()</link> et
|
||||
<link linkend="language.function.assign">{assign}</link>.
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
@@ -66,4 +90,4 @@ End:
|
||||
vim600: syn=xml fen fdm=syntax fdl=2 si
|
||||
vim: et tw=78 syn=sgml
|
||||
vi: ts=1 sw=1
|
||||
-->
|
||||
-->
|
||||
Reference in New Issue
Block a user