mirror of
https://github.com/smarty-php/smarty.git
synced 2025-11-11 17:43:50 +01:00
sync with EN
This commit is contained in:
@@ -1,8 +1,12 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- $Revision$ -->
|
||||
<!-- EN-Revision: 1.3 Maintainer: gerald Status: ready -->
|
||||
<!-- EN-Revision: 1.6 Maintainer: yannick Status: ready -->
|
||||
|
||||
<sect1 id="language.function.assign">
|
||||
<title>assign</title>
|
||||
<title>{assign}</title>
|
||||
<para>
|
||||
{assign} est utilis<69> pour d<>clarer ou modifier des variables de template.
|
||||
</para>
|
||||
<informaltable frame="all">
|
||||
<tgroup cols="5">
|
||||
<colspec colname="param" align="center" />
|
||||
@@ -37,11 +41,8 @@
|
||||
</tbody>
|
||||
</tgroup>
|
||||
</informaltable>
|
||||
<para>
|
||||
{assign} est utilis<69> pour d<>clarer ou modifier des variables de template.
|
||||
</para>
|
||||
<example>
|
||||
<title>assign</title>
|
||||
<title>{assign}</title>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{assign var="name" value="Bob"}
|
||||
@@ -58,12 +59,69 @@ La valeur de $name est Bob.
|
||||
]]>
|
||||
</screen>
|
||||
</example>
|
||||
|
||||
<example>
|
||||
<title>Acc<EFBFBD>s aux variables {assign} depuis un script PHP.</title>
|
||||
<para>
|
||||
Pour acc<63>der aux variables {assign} depuis PHP, utilisez
|
||||
<link linkend="api.get.template.vars">get_template_vars()</link>.
|
||||
Cependant, les variables ne sont disponibles qu'apr<70>s ou pendant l'ex<65>cution du
|
||||
template, comme le montre l'exemple suivant :
|
||||
</para>
|
||||
<programlisting>
|
||||
<![CDATA[
|
||||
{* index.tpl *}
|
||||
{assign var="foo" value="Smarty"}
|
||||
]]>
|
||||
</programlisting>
|
||||
<programlisting role="php">
|
||||
<![CDATA[
|
||||
<?php
|
||||
|
||||
// ceci n'affichera rien car le template n'a pas encore <20>t<EFBFBD> ex<65>cut<75>
|
||||
echo $smarty->get_template_vars('foo');
|
||||
|
||||
// Ex<45>cution du template
|
||||
$dead = $smarty->fetch('index.tpl');
|
||||
|
||||
// Ceci affichera 'smarty' car le template a <20>t<EFBFBD> ex<65>cut<75>
|
||||
echo $smarty->get_template_vars('foo');
|
||||
|
||||
$smarty->assign('foo','Even smarter');
|
||||
|
||||
// Ceci affichera 'Even smarter'
|
||||
echo $smarty->get_template_vars('foo');
|
||||
|
||||
?>
|
||||
]]>
|
||||
</programlisting>
|
||||
</example>
|
||||
|
||||
|
||||
<para>
|
||||
Voir aussi
|
||||
Les fonctions suivantes peuvent <emphasis>optionnellement</emphasis> assigner
|
||||
des variables de template.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
<link linkend="language.function.capture">{capture}</link>,
|
||||
<link linkend="language.function.include">{include}</link>,
|
||||
<link linkend="language.function.include.php">{include_php}</link>,
|
||||
<link linkend="language.function.insert">{insert}</link>,
|
||||
<link linkend="language.function.counter">{counter}</link>,
|
||||
<link linkend="language.function.cycle">{cycle}</link>,
|
||||
<link linkend="language.function.eval">{eval}</link>,
|
||||
<link linkend="language.function.fetch">{fetch}</link>,
|
||||
<link linkend="language.function.math">{math}</link> et
|
||||
<link linkend="language.function.textformat">{textformat}</link>.
|
||||
</para>
|
||||
<para>
|
||||
Voir aussi
|
||||
<link linkend="api.assign">assign()</link> et
|
||||
<link linkend="api.get.template.vars">get_template_vars()</link>.
|
||||
</para>
|
||||
</sect1>
|
||||
|
||||
<!-- Keep this comment at the end of the file
|
||||
Local variables:
|
||||
mode: sgml
|
||||
@@ -83,4 +141,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