Add {import} + tests

This commit is contained in:
bzick
2013-02-23 13:29:20 +04:00
parent 703607102f
commit b3480e820b
5 changed files with 58 additions and 21 deletions

View File

@@ -4,12 +4,12 @@ Tag {import}
Import [macro](./macro.md) from another template
```smarty
{import 'page.macros.tpl'}
{import 'math.tpl'}
```
```smarty
{import 'listing.tpl' as listing}
{import 'math.tpl' as math}
...
{listing.paginator current=5 count=100}
{math.plus x=5 y=100}
```

View File

@@ -1,20 +1,18 @@
Tag {macro}
============
Declare
Declare macro
```smarty
declare macros
{macro paginator(current, total, skip=true)}
... paginator code ...
{macro plus(x, y, z=0)}
x + y + z = {$x + $y + $z}
{/macro}
```
Invoke
Invoke macro
```smarty
{paginator current=$page total=100}
{macro.plus x=$num y=100}
```
Use tag [{import}](./import.md) for extending macros for another templates.
Use tag [{import}](./import.md) for importing existing macroses into another template