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

Fernando Martins fmartins@hetnet.nl
Fri, 27 Dec 2002 14:25:45 +0100


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