The situation: I have a "main_template" that does the looks of the site, with a "main" slot where the content goes, much like the standard templates give you. Now I have objects that behave similarly and share some interface components, so I figured I could try to create another macro, with another slot to fit inside that "main" slot, that all of the objects/content types could re-use. So I end up doing what I said below ... But that doesn't work :( I've come up with an alternative for now, though it's not as elegant as this I think ... But it'll have to do. If you care to keep reading, the details: main_template: <define-macro="master"> <... some html ...> <define-slot="main" /> <... some html ...> </define-macro> shared template: <use-macro="main_template/master"> <fill-slot="main"> <define-macro="shared"> <... some html ...> <define-slot="sharedslot" /> <... some html ...> </define-macro> </fill-slot> </use-macro> Object specific template: <use-macro="shared"> <fill-slot="sharedslot"> <... some html ...> </fill-slot> </use-macro> This works without errors, except that only the first macro "shared" comes out, the "master" one never gets processed :( I would've expected this to be recursive ... Ah well :( Thanks! J.F. -----Original Message----- From: zope-bounces@zope.org [mailto:zope-bounces@zope.org] On Behalf Of J Cameron Cooper Sent: January 26, 2006 12:52 AM To: Doyon, Jean-Francois Cc: zope@zope.org Subject: Re: [Zope] Can one nest macros with slots? Doyon, Jean-Francois wrote:
I can't seem to do this:
<use-macro> <fill-slot> <define-macro> <... Some html ...> <define-slot></define-slot> <... Some html ...> </define-macro> </fill-slot> </use-macro>
Allowing me to nest multiple reusable templates?
I have objects with common interfaces which could easily share templates ... If I could do this! (The shared template still needs to endup in the "master" template).
Or are there other techniques to achieve this?
Macros are decided at compile time so that you can ask a template (which is not called) for its macros:: here/main_template/macros/master The code above would have macros being created in some other template at the time this macros is used, and I cannot imagine how they would be available. Why is a macro with whatever uses your common interfaces not suitable? You scenario is too vague for any other advice. --jcc -- Building Websites with Plone http://plonebook.packtpub.com/ _______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )