ZPT-JS reference - Attributes - METALFillSlot

Syntax

argument ::= expression
                

Description

The data-fill-slot statement customizes a macro by replacing a slot in the macro with the statement element (and its content).

The data-fill-slot statement must be used inside a data-use-macro statement. Slot names must be unique within a macro.

If the named slot does not exist within the macro, the slot contents will be silently dropped.

Note: some parts extracted from Zope Page Templates Reference.

Differences with ZPT

Examples

Given this macro::

        <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>
                

You can fill the links slot like so:

        <div data-use-macro="'enhacedSidebar'">
            <div data-fill-slot="'links'">
                <ul>
                    <li><a href="/">Home</a></li>
                    <li><a href="/otherProducts">Other products</a></li>
                    <li><a href="/sales">Sales!</a></li>
                </ul>
            </div>
        </div>