What is Smarty?
Why use it?
Use Cases and Work Flow
Syntax Comparison
Template Inheritance
Best Practices
Crash Course
You may use the Smarty logo according to the trademark notice.
For sponsorship, advertising, news or other inquiries, contact us at:
Этот модификатор используется для форматирования строк, таких как десятичные числа и т.д. Используйте синтаксис от sprintf() для форматирования.
Позиция параметра | Тип | Обязателен | По умолчанию | Описание |
---|---|---|---|---|
1 | string | Да | n/a | Формат для использования (sprintf). |
Example 5.17. string_format
<?php $smarty->assign('number', 23.5787446); ?>
Шаблон:
{$number} {$number|string_format:"%.2f"} {$number|string_format:"%d"}
This should output:
23.5787446 23.58 24
См. также date_format.