ZPT-JS reference - Attributes - METALDefineSlot

Syntax

argument ::= Name
                

Description

The data-define-slot statement defines a macro customization point or slot. When a macro is used, its slots can be replaced, in order to customize the macro. Slot definitions provide default content for the slot. You will get the default slot contents if you decide not to customize the macro when using it.

The data-define-slot statement must be used inside a data-define-macro statement.

Slot names must be unique within a macro.

Note: some parts extracted from Zope Page Templates Reference.

Differences with ZPT

None.

Examples

Macro with 1 slot (additional_info):

        <div data-define-macro="enhacedSidebar">
            Links
            <div>
                <ul>
                    <li><a href="/">Home</a></li>
                    <li><a href="/products">Products</a></li>
                    <li><a href="/support">Support</a></li>
                    <li><a href="/contact">Contact Us</a></li>
                </ul>
            </div>
            <span data-define-slot="additional_info"></span>
        </div>
                

Macro with 2 slots (links and additional_info):

        <div data-define-macro="enhacedSidebar">
            Links
            <div data-define-slot="links">
                <ul>
                    <li><a href="/">Home</a></li>
                    <li><a href="/products">Products</a></li>
                    <li><a href="/support">Support</a></li>
                    <li><a href="/contact">Contact Us</a></li>
                </ul>
            </div>
            <span data-define-slot="additional_info"></span>
        </div>