mirror of
https://github.com/fenom-template/fenom.git
synced 2023-08-10 21:13:07 +03:00
31 lines
342 B
Markdown
31 lines
342 B
Markdown
Tag {macro}
|
|
============
|
|
|
|
Declare macro
|
|
|
|
```smarty
|
|
{macro plus(x, y, z=0)}
|
|
x + y + z = {$x + $y + $z}
|
|
{/macro}
|
|
```
|
|
|
|
Invoke macro
|
|
|
|
```smarty
|
|
{macro.plus x=$num y=100}
|
|
```
|
|
|
|
### {import}
|
|
|
|
Import [macro](./macro.md) from another template
|
|
|
|
```smarty
|
|
{import 'math.tpl'}
|
|
```
|
|
|
|
```smarty
|
|
{import 'math.tpl' as math}
|
|
...
|
|
{math.plus x=5 y=100}
|
|
```
|