ZPT-JS reference - Attributes - METALUseMacro

Syntax

argument ::= expression
                

Description

The data-use-macro statement replaces the statement element with a macro. The statement expression describes a macro definition.

In ZPT-JS the expression will generally be a path expression referring to a macro defined in another template. See data-define-macro for more information.

The effect of expanding a macro is to graft a subtree from another document (or from elsewhere in the current document) in place of the statement element, replacing the existing sub-tree. Parts of the original subtree may remain, grafted onto the new subtree, if the macro has slots. See data-define-slot for more information.

Note: some parts extracted from Zope Page Templates Reference.

Differences with ZPT

Examples

Invokation of copyright macro in the same file (internal macro invokation):

<p data-use-macro="'copyright'">
    Macro goes here
</p>
                

Invokation of copyright macro in macros.html file (external macro invokation):

<p data-use-macro="'copyright@macros.html'">
    Macro goes here
</p>
                

Invokation of macro defined by macroPath variable (it can be an internal or external macro invokation):

<p data-use-macro="macroPath">
    Macro goes here
</p>