[ZPT] Using define-macro and use-macro together

Troy Farrell troy@entheossoft.com
Fri, 27 Dec 2002 08:36:34 -0600


There was a thread here about 1 week ago called "tal:define and 
metal:use-macro."  Dieter answered your question there:

Quoth Dieter:
> Because the macro replaces the complete tag containing the
> "metal:use-macro".

In theory, the use-macro replaces the tag, so the defined-macro is never 
defined.  Now, that may not be exactly right.  It would be nice if we 
had an Order of Operation list that had METAL mixed with TAL.  You can 
see a TAL only version at 
http://localhost:8080/Control_Panel/Products/PageTemplates/Help/tal.stx 
if you run Zope locally.

Troy

Fernando Martins wrote:
> I was trying to implement a sort of HTML template inheritance (based on
> ZPT/METAL) by using a full-page macro that uses another full-page macro.
> 
> This allows me to have a main page template and several sub-templates, i.e.,
> templates which includes the elements from the main template as well as new
> elements (e.g., a 2nd level menu, etc.) to be used by a sub-set of pages of
> the web site.
> 
> For this, it would be nice if I could have
> 
> <html metal:define-macro="macro_sub1"
>       metal:use-macro="container/pt_macr/macros/macro_main">
> 
> However, Zope doesn't compile the ZPT complaining about having define-macro
> and use-macro together.
> 
> I can work around this problem by using
> 
> <metal:block define-macro="macro_sub1">
> <html metal:use-macro="container/pt_macr/macros/macro_main">
> 
> but it's ugly.
> 
> So, is there any good reason for not allowing both METAL statements
> together?
> 
> Is there a better work around other than using <metal:block>?
> 
> Regards,
> 
> Fernando Martins
> 
> 
> _______________________________________________
> ZPT mailing list
> ZPT@zope.org
> http://lists.zope.org/mailman/listinfo/zpt