From c00a2c708a3a1905a2707b745b095aab041dcfe5 Mon Sep 17 00:00:00 2001 From: bzick Date: Mon, 4 Mar 2013 10:13:59 +0400 Subject: [PATCH] Update docs --- docs/main.md | 3 +-- docs/tags/import.md | 15 --------------- docs/tags/macro.md | 14 +++++++++++++- docs/tags/var.md | 17 ++++++++++++++--- 4 files changed, 28 insertions(+), 21 deletions(-) delete mode 100644 docs/tags/import.md diff --git a/docs/main.md b/docs/main.md index c08a8fd..922ed2c 100644 --- a/docs/main.md +++ b/docs/main.md @@ -40,8 +40,7 @@ Documentation * [capture](./tags/capture.md) * [filter](./tags/filter.md) * [ignore](./tags/ignore.md) -* [macro](./tags/macro.md) -* [import](./tags/import.md) +* [macro](./tags/macro.md) and `import` [Using](./syntax.md#tags) and [addition](./ext/tags.md) of tags. diff --git a/docs/tags/import.md b/docs/tags/import.md deleted file mode 100644 index dc957e9..0000000 --- a/docs/tags/import.md +++ /dev/null @@ -1,15 +0,0 @@ -Tag {import} -============ - -Import [macro](./macro.md) from another template - -```smarty -{import 'math.tpl'} -``` - -```smarty -{import 'math.tpl' as math} -... -{math.plus x=5 y=100} -``` - diff --git a/docs/tags/macro.md b/docs/tags/macro.md index 439a3b6..5ca3cbe 100644 --- a/docs/tags/macro.md +++ b/docs/tags/macro.md @@ -15,4 +15,16 @@ Invoke macro {macro.plus x=$num y=100} ``` -Use tag [{import}](./import.md) for importing existing macroses into another template \ No newline at end of file +### {import} + +Import [macro](./macro.md) from another template + +```smarty +{import 'math.tpl'} +``` + +```smarty +{import 'math.tpl' as math} +... +{math.plus x=5 y=100} +``` diff --git a/docs/tags/var.md b/docs/tags/var.md index d5dd5de..4af35e9 100644 --- a/docs/tags/var.md +++ b/docs/tags/var.md @@ -7,6 +7,13 @@ Tag {var} {var $var=EXPR} ``` + +```smarty +{var $var} + ... any content ... +{/var} +``` + К названию новой переменной предъявляются те же требования, что и к [именам переменных](http://www.php.net/manual/en/language.variables.basics.php) в PHP. Выражение EXPR подразумевает любое поддерживаемое выражение. @@ -15,7 +22,7 @@ Tag {var} {var $v = "value"} {var $v = $x+$y} -{var $v = $z++} +{var $v = 4} {var $v = $z++ + 1} {var $v = --$z} {var $v = $y/$x} @@ -23,14 +30,18 @@ Tag {var} {var $v = $y*$x-2} {var $v = ($y^$x)+7} -// Присваивание массивов +Присваивание массивов {var $v = [1,2,3]} {var $v = []} {var $v = ["one"|upper => 1, 4 => $x, "three" => 3]} {var $v = ["key1" => $y*$x-2, "key2" => ["z" => $z]]} -// Присваивание результата выполнения функции +Присваивание результата выполнения функции {var $v = count([1,2,3])+7} + +{var $v} + Some long {$text|trim} +{/var} ```