fenom/docs/tags/include.md
2013-09-02 17:40:58 +04:00

46 lines
1.0 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

Tag {include} [RU]
==================
`{include}` tags are used for including other templates in the current template. Any variables available in the current template are also available within the included template.
```smarty
{include "about.tpl"}
```
Переменные для подключаемого шаблона можно переопределить, задавая их аргументами тега.
```smarty
{include "about.tpl" page=$item limit=50}
```
Все изменения переменных в подключаемом шаблоне не будут воздействовать на родительский шаблон.
### {insert}
The tag insert template code instead self.
* No dynamic name allowed
* No variables as attribute allowed
For example, main.tpl:
```smarty
a: {$a}
{insert 'b.tpl'}
c: {$c}
```
b.tpl:
```
b: {$b}
```
Во время разбора шаблона код шаблона `b.tpl` будет вставлен в код шаблона `main.tpl` как есть:
```smarty
a: {$a}
b: {$b}
c: {$c}
```