Prev |  | Next

### `metal:define-macro`

This attribute declares a macro. Think of macros as library of small templates which can be reused in any other template.

                <div metal:define-macro="main_menu"><ul><li><a href="/">home</a></li><li><a href="/products">products</a></li><li><a href="/contact">contact</a></li></ul><div>
        Last modified:
        <span tal:content="mdate">page modification date</span></div></div>

Macros inherit all variables from their caller. In the above example, the variable ' `mdate`' depends on the template that calls the macro.

Prev | Up | Next
METAL namespace | Home | `metal:use-macro`