smarty template engine
Friday, July 25, 2008  
download | documentation | faq | forum | mailing lists | changelog | contribs 


search for in the  


string_format

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.

Position du paramètreTypeRequisDefautDescription
1chaîne de caractèresOuin/aLe format à utiliser (sprintf)

Exemple 5-18. string_format

<?php

$smarty
->assign('nombre'23.5787446);

?>

Où le template est :

{$nombre}
{$nombre|string_format:"%.2f"}
{$nombre|string_format:"%d"}

Affichera :

23.5787446
23.58
24

Voir aussi date_format.




 

credits 

Smarty Copyright © 2002-2008
New Digital Group, Inc.

All rights reserved.