siteheader.xml template file:

<div metal:define-macro="siteheader" id="header">
    <tal:block metal:define-slot="debug"/>
    <p>Some example text</p>
    <img src="stuff.png" alt="stuff"/>

Actual file rendered:

<tal:block metal:use-macro="siteheader.xml/siteheader">
    <p metal:fill-slot="debug" class="debug" tal:condition="user/is_admin">
        Debug Messages:
        <tal:block tal:content="debug_log"/>

As you can see, the slot is used to combine replace a piece of my template
at runtime...

Marco Pivetta

On 11 July 2011 09:10, Anton Andriyevskyy <> wrote:

> I still do not understand when and why to use slots,
> I always use macro.
> Can anyone show me a meaningful and useful example demonstrating when slots
> are better then macro?
> Regards,
> Anton Andriyevskyy
> Business Automation & Web Development
> _______________________________________________
> PHPTAL mailing list
PHPTAL mailing list

Reply via email to