Files
smarty/docs/fr/designers/language-modifiers/language-modifier-string-format.xml
2004-05-23 15:50:53 +00:00

79 lines
1.8 KiB
XML

<?xml version="1.0" encoding="iso-8859-1"?>
<!-- $Revision$ -->
<!-- EN-Revision: 1.1 Maintainer: nobody Status: partial -->
<sect1 id="language.modifier.string.format">
<title>string_format</title>
<informaltable frame="all">
<tgroup cols="5">
<colspec colname="param" align="center" />
<colspec colname="type" align="center" />
<colspec colname="required" align="center" />
<colspec colname="default" align="center" />
<colspec colname="desc"/>
<thead>
<row>
<entry>Position du paramètre</entry>
<entry>Type</entry>
<entry>Requis</entry>
<entry>Defaut</entry>
<entry>Description</entry>
</row>
</thead>
<tbody>
<row>
<entry>1</entry>
<entry>chaîne de caractères</entry>
<entry>Oui</entry>
<entry><emphasis>n/a</emphasis></entry>
<entry>Le format à utiliser (sprintf)</entry>
</row>
</tbody>
</tgroup>
</informaltable>
<para>
Un moyen pour formater les chaînes de caractères, comme par exemple les
nombres décimaux. Utilise la syntaxe de sprintf pour formater les éléments.
</para>
<example>
<title>string_format</title>
<programlisting>
index.php:
$smarty = new Smarty;
$smarty-&gt;assign('nombre', 23.5787446);
$smarty-&gt;display('index.tpl');
index.tpl:
{$nombre}
{$nombre|string_format:"%.2f"}
{$nombre|string_format:"%d"}
SORTIE:
23.5787446
23.58
24</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
-->