From b34a1e1013a65808db2e1888db652e2fd2b63b21 Mon Sep 17 00:00:00 2001 From: Ivan Shalganov Date: Tue, 28 Jan 2014 19:31:26 +0200 Subject: [PATCH] Update docs --- docs/syntax.md | 12 +++++++++++- docs/tags/macro.md | 2 +- docs/tags/raw.md | 11 ++++++----- sandbox/templates/greeting.tpl | 8 ++++---- 4 files changed, 22 insertions(+), 11 deletions(-) diff --git a/docs/syntax.md b/docs/syntax.md index e9de09f..8707ab6 100644 --- a/docs/syntax.md +++ b/docs/syntax.md @@ -77,8 +77,18 @@ See all [operators](./operators.md) {$object->item->method($y->name, 'named')|upper} {* apply modifier to method result*} ``` -You may disable call methods in template, see [security options](./settings.md) +You may disable call methods in template, see in [security options](./settings.md) option `deny_method` +### Static method support + +```smarty +{Lib\Math::multiple x=3 y=4} static method as tag +{Lib\Math::multiple(3,4)} inline static method +{12 + Lib\Math::multiple(3,4)} +{12 + 3|Lib\Math::multiple:4} static method as modifier +``` + +You may disable call static methods in template, see in [security options](./settings.md) option `deny_static` ### Set variable diff --git a/docs/tags/macro.md b/docs/tags/macro.md index bac80f2..9d0d6c9 100644 --- a/docs/tags/macro.md +++ b/docs/tags/macro.md @@ -9,7 +9,7 @@ Tag {macro} [RU] Обявление макроса происходит при помощи блочного тега `{macro}` ```smarty -{macro plus(x, y, z=0)} +{macro plus($x, $y, $z=0)} x + y + z = {$x + $y + $z} {/macro} ``` diff --git a/docs/tags/raw.md b/docs/tags/raw.md index c3b3db3..1b116b4 100644 --- a/docs/tags/raw.md +++ b/docs/tags/raw.md @@ -1,7 +1,8 @@ -Tag {raw} [RU] -================== +Tag {raw} +========= -Тег `{raw }` позволяет выводить результат выражения или функций без экранирования, игнорируя глобальную настройку `auto_secape`. +Tag `{raw }` allow outputs render results without escaping. +This tag rewrite global option `auto_escape` for specified code. ```smarty {autoescape true} @@ -15,7 +16,7 @@ Tag {raw} [RU] {/autoescate} ``` -Для результатов функций то же может быть отключено экранирование: +For functions use tag with prefix `raw:`: ```smarty {autoescape true} @@ -26,4 +27,4 @@ Tag {raw} [RU] {/autoescate} ``` -На компиляторы свойство raw не распространяется. \ No newline at end of file +Tag can not be applied to compilers as `foreach`, `if` and other. \ No newline at end of file diff --git a/sandbox/templates/greeting.tpl b/sandbox/templates/greeting.tpl index 452daf9..156d705 100644 --- a/sandbox/templates/greeting.tpl +++ b/sandbox/templates/greeting.tpl @@ -1,5 +1,5 @@ -{import 'macros.tpl' as mc} -A1 -{mc.factorial num=10} -A2 \ No newline at end of file + +{Ts\Math::multi x=34 y=44} +{$a + Ts\Math::multi(34, 44)} +{34|Ts\Math::multi:44} \ No newline at end of file