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"/>
</div>




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:
        <br/>
        <tal:block tal:content="debug_log"/>
    </p>
</tal:block>


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

Marco Pivetta
http://twitter.com/Ocramius
http://marco-pivetta.com



On 11 July 2011 09:10, Anton Andriyevskyy <x.meg...@gmail.com> 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@lists.motion-twin.com
> http://lists.motion-twin.com/mailman/listinfo/phptal
>
>
_______________________________________________
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal

Reply via email to