This attribute must appear inside a metal:define-macro tag.

Slots can be replaced by caller template with some custom dynamically-generated XML/XHTML.

Slots can be thought of like reverse includes, a macro can be an entire page and slots customize this page depending on the URL. For instance, a slot may contain the latest news in the home page or user actions when the member is logged in.

<span metal:define-slot="news_place">
    <tr tal:repeat="item php:latestNews()">
      <td tal:content="item/value">news description</td>

The above example defines a place called 'news_place' which can be overwritten by caller templates. See next section for the continuation of this example.


Slots work like variables, not like callbacks. metal:define-slot in tal:repeat will always repeat the same value over and over again.