Files
smarty/docs/fr/designers/language-variables/language-config-variables.xml
2004-04-13 15:43:47 +00:00

96 lines
2.5 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<sect1 id="language.config.variables">
<title>Variables chargées depuis des fichiers de configuration</title>
<para>
Les variables récupérées depuis un fichier de configuration sont utilisées
entourées du symbole dièse (#), ou via la variable spéciale smarty
<link
linkend="language.variables.smarty.config">$smarty.config</link>.
</para>
<example>
<title>variables de fichiers de configuration</title>
<programlisting>
foo.conf:
pageTitle = "C'est le mien"
bodyBgColor = "#eeeeee"
tableBorderSize = "3"
tableBgColor = "#bbbbbb"
rowBgColor = "#cccccc"
index.tpl:
{config_load file="foo.conf"}
&lt;html&gt;
&lt;title&gt;{#pageTitle#}&lt;/title&gt;
&lt;body bgcolor="{#bodyBgColor#}"&gt;
&lt;table border="{#tableBorderSize#}" bgcolor="{#tableBgColor#}"&gt;
&lt;tr bgcolor="{#rowBgColor#}"&gt;
&lt;td&gt;First&lt;/td&gt;
&lt;td&gt;Last&lt;/td&gt;
&lt;td&gt;Address&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/body&gt;
&lt;/html&gt;
index.tpl: (alternate syntax)
{config_load file="foo.conf"}
&lt;html&gt;
&lt;title&gt;{$smarty.config.pageTitle}&lt;/title&gt;
&lt;body bgcolor="{$smarty.config.bodyBgColor}"&gt;
&lt;table border="{$smarty.config.tableBorderSize}" bgcolor="{$smarty.config.tableBgColor}"&gt;
&lt;tr bgcolor="{$smarty.config.rowBgColor}"&gt;
&lt;td&gt;First&lt;/td&gt;
&lt;td&gt;Last&lt;/td&gt;
&lt;td&gt;Address&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/body&gt;
&lt;/html&gt;
SORTIE: (same for both examples)
&lt;html&gt;
&lt;title&gt;C'est le mien&lt;/title&gt;
&lt;body bgcolor="#eeeeee"&gt;
&lt;table border="3" bgcolor="#bbbbbb"&gt;
&lt;tr bgcolor="#cccccc"&gt;
&lt;td&gt;First&lt;/td&gt;
&lt;td&gt;Last&lt;/td&gt;
&lt;td&gt;Address&lt;/td&gt;
&lt;/tr&gt;
&lt;/table&gt;
&lt;/body&gt;
&lt;/html&gt;</programlisting>
</example>
<para>
Les variables de fichier de configuration ne peuvent être utilisés tant
qu'elles n'ont pas été chargées. Cette procédure est expliquée
plus loin dans le document, voir <command>config_load</command>.
</para>
</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
-->