string_format
Este é um meio para formatar strings, como números decimais e outros. Use a sintaxe para sprintf para a formatação.
Exemplo 5-18. string_format
index.php:
$smarty = new Smarty;
$smarty->assign('number', 23.5787446);
$smarty->display('index.tpl');
index.tpl:
{$number}
{$number|string_format:"%.2f"}
{$number|string_format:"%d"}
MOSTRA:
23.5787446
23.58
24
|
|