Files
smarty/docs/fr/designers/language-variables/language-variables-smarty.xml
2004-12-22 19:59:35 +00:00

155 lines
4.5 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<!-- EN-Revision: 1.4 Maintainer: gerald 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
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:
</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 *}
{$smarty.get.page}
{* affiche la variable "page" récupérée depuis un formulaire (POST) *}
{$smarty.post.page}
{* affiche la valeur du cookie "utilisateur" *}
{$smarty.cookies.utilisateur}
{* affiche la variable serveur "SERVER_NAME" *}
{$smarty.server.SERVER_NAME}
{* affiche la variable d'environnement "PATH" *}
{$smarty.env.PATH}
{* affiche la variable de session PHP "id" *}
{$smarty.session.id}
{* affiche la variable "utilisateur" du regroupement de get/post/cookies/server/env *}
{$smarty.request.utilisateur}
]]>
</programlisting>
</example>
</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 nombre obtenu correspond au nombre de secondes écoulées depuis
Epoch (1 Janvier 1970) et peut être passé directement au modificateur
de variable date à des fins d'affichage.
</para>
<example>
<title>utilisation de {$smarty.now}</title>
<programlisting>
<![CDATA[
{* utilise le modificateur de variable date_format pour afficher la date et heure *}
{$smarty.now|date_format:"%d-%m-%Y %H:%M:%S"}
]]>
</programlisting>
</example>
</sect2>
<sect2 id="language.variables.smarty.const">
<title>{$smarty.const}</title>
<para>
Vous pouvez directement accéder aux constantes PHP.
</para>
<example>
<title>Utiliser {$smarty.const}</title>
<programlisting>
<![CDATA[
{$smarty.const._MA_CONSTANTE_}
]]>
</programlisting>
</example>
</sect2>
<sect2 id="language.variables.smarty.capture">
<title>{$smarty.capture}</title>
<para>
La capture réalisée via {capture}..{/capture} 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
exemple à ce sujet.
</para>
</sect2>
<sect2 id="language.variables.smarty.config">
<title>{$smarty.config}</title>
<para>
La variable {$smarty} peut être utilisée pour désigner une variable
d'un fichier de configuration. {$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>
<sect2 id="language.variables.smarty.loops">
<title>{$smarty.section}, {$smarty.foreach}</title>
<para>
La variable {$smarty} peut être utilisée pour accéder aux propriétés
des boucles 'section' et 'foreach'. Voir la documentation de
<link linkend="language.function.section">section</link> et
<link linkend="language.function.foreach">foreach</link>.
</para>
</sect2>
<sect2 id="language.variables.smarty.template">
<title>{$smarty.template}</title>
<para>
Cette variable contient le nom du template en cours de traitement.
</para>
</sect2>
<sect2 id="language.variables.smarty.ldelim">
<title>{$smarty.ldelim}</title>
<para>
Cette variable est utilisée pour afficher le délémiteur gauche. Lisez aussi
la partie <link
linkend="language.function.ldelim">{ldelim},{rdelim}</link>.
</para>
</sect2>
<sect2 id="language.variables.smarty.rdelim">
<title>{$smarty.rdelim}</title>
<para>
Cette variable est utilisée pour afficher le délémiteur droit. Lisez aussi
la partie <link linkend="language.function.ldelim">{ldelim},{rdelim}</link>.
</para>
</sect2>
</sect1>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
indent-tabs-mode:nil
sgml-parent-document:nil
sgml-default-dtd-file:"../../../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
vim600: syn=xml fen fdm=syntax fdl=2 si
vim: et tw=78 syn=sgml
vi: ts=1 sw=1
-->