[модификатор substr]

shark_255

Новичок
[модификатор substr]

на вот такой страничке описано исользование модификатора substring

http://smarty.incutio.com/?page=substring


и кусочек такого кода
{$var|substr:0:4}

такого модификатора в папке plugins я не обнаружил.
В документации про модификаторы не написано про использование пхп-шных
функций как модификаторов в шаблонах смарти.
Но это работает =)

То есть это недокументированная функция или я чего-то недопонимаю ?
 

MiRacLe

просто Чудо
Ты чего-то недопонимаешь.

All php-functions can be used as modifiers implicitly, as demonstrated in the example above. However, using php-functions as modifiers has two little pitfalls:

* First - sometimes the order of the function-parameters is not the desirable one. Formatting $foo with {"%2.f"|sprintf:$foo} actually works, but asks for the more intuitive, like {$foo|string_format:"%2.f"} that is provided by the Smarty distribution.
* Secondly - if $security is enabled, all php-functions that are to be used as modifiers have to be declared trusted in the MODIFIER_FUNCS element of the $security_settings array.
 

shark_255

Новичок
chm справка по смарти оказалась урезанной. Спасибо
за подсказку )
 
Сверху