[Zope3-dev] New METAL extension feature

shane at hathawaymix.org shane at hathawaymix.org
Mon Nov 22 13:46:56 EST 2004



On Mon, 22 Nov 2004, Paul Winkler wrote:

> On Mon, Nov 22, 2004 at 11:12:37AM -0700, shane at hathawaymix.org wrote:
>> Let's say some graphic designers get together and develop a nice skin.
>> Here is its page macro:
>>
>> <html metal:define-macro="page">
>>  <head>
>>   <metal:block define-slot="headers" />
>>   <title metal:define-slot="title">Cool Skin</title>
>>  </head>
>>  <body>
>>   <div metal:define-slot="content" />
>>   <div metal:define-slot="footer" />
>>  </body>
>> </html>
>>
>> An independent company wants to customize that skin, replacing certain
>> slots.  The company would use macro extension:
>>
>> <html metal:define-macro="page"
>>       metal:use-macro="coolskin_page">
>
> At least one of us is confused ;-)
> Did you get that right, or is it:
>
> <html metal:define-macro="coolskin_page"
>       metal:use-macro="page">
>
> Otherwise, I don't see where coolskin_page comes from.

"coolskin_page" refers to the "page" macro defined by coolskin.  I should 
have written it this way:

<html metal:define-macro="page"
       metal:use-macro="context/@@coolskin_macros/page">

"coolskin_macros" is a view that grabs the standard macros from coolskin. 
One of the standard macros in coolskin is "page", which comes from the 
first template I listed.

The name of the macro being defined needs to be "page" because the 
convention in Zope 3 templates is to get the skin's page macro via 
"context/@@standard_macros/page".

I don't know whether macro extension will become the standard way to 
customize a skin, but I think it's a good way.  It encourages a separation 
of concerns: coolskin cares about general appearance and behavior, 
companies care about company-wide logos and boilerplate text, and coders 
care about application functionality and miscellaneous per-template 
details (auto-reloading the page, for example.)

Shane


More information about the Zope3-dev mailing list