mirror of
https://github.com/fenom-template/fenom.git
synced 2023-08-10 21:13:07 +03:00
Add {import} + tests
This commit is contained in:
@@ -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}
|
||||
```
|
||||
|
||||
|
@@ -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
|
Reference in New Issue
Block a user