mirror of
https://github.com/smarty-php/smarty.git
synced 2025-11-08 00:01:38 +01:00
48 lines
1.7 KiB
XML
48 lines
1.7 KiB
XML
|
|
<?xml version="1.0" encoding="iso-8859-1"?>
|
|||
|
|
<!-- $Revision$ -->
|
|||
|
|
<sect1 id="language.syntax.quotes">
|
|||
|
|
<title>Variables ins<6E>r<EFBFBD>es dans des cha<68>nes de caract<63>res</title>
|
|||
|
|
<para>
|
|||
|
|
Smarty est capable d'interpr<70>ter les variables ins<6E>r<EFBFBD>es <20> l'int<6E>rieur de
|
|||
|
|
cha<68>nes entre guillemets, du moment que leur nom est exclusivement compos<6F>
|
|||
|
|
de chiffres, lettres, underscores et crochets. Si le nom de la variable
|
|||
|
|
contient tout autre caract<63>re (point, r<>f<EFBFBD>rence <20> un objet, etc.)
|
|||
|
|
la variable doit <20>tre entour<75>e d'apostrophes inverses (`).
|
|||
|
|
</para>
|
|||
|
|
<example>
|
|||
|
|
<title>Syntaxe d'insertion de variables dans des cha<68>nes</title>
|
|||
|
|
<programlisting>
|
|||
|
|
EXEMPLE DE SYNTAXE:
|
|||
|
|
{func var="test $foo test"} <-- comprends $foo
|
|||
|
|
{func var="test $foo_bar test"} <-- comprends $foo_bar
|
|||
|
|
{func var="test $foo[0] test"} <-- comprends $foo[0]
|
|||
|
|
{func var="test $foo[bar] test"} <-- comprends $foo[bar]
|
|||
|
|
{func var="test $foo.bar test"} <-- comprends $foo (not $foo.bar)
|
|||
|
|
{func var="test `$foo.bar` test"} <-- comprends $foo.bar
|
|||
|
|
|
|||
|
|
EXEMPLE PRATIQUE:
|
|||
|
|
{include file="subdir/$tpl_name.tpl"} <-- remplace $tpl_name avec la valeur
|
|||
|
|
{cycle values="one,two,`$smarty.config.myval`"} <-- doit comporter les
|
|||
|
|
apostrophes inverses</programlisting>
|
|||
|
|
</example>
|
|||
|
|
</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
|
|||
|
|
-->
|