[Zope3-dev] Re:

Tonico Strasser contact_tonico at yahoo.de
Tue Nov 9 15:51:46 EST 2004


Jim Fulton wrote:
> For me, the scope is broader than that.  Uptimately, the goal is to
> produce pages that end users see.  I see composition at various levels.
> For example, I'm *finally* understanding how poorly our page-macro
> system works.  When a developer defines a page as a view of some
> object, they shouldn't have to say how the page is wrapped with the
> site look and feel. That should be the concern of someone else.
> There should be a mechanism for "composing" these pages with the site
> look at feel.

Thinking in page templates I would try to solve it this way:

pt_1: The layout
---
<layout metal:define-macro="layout">
   <main>
     <wrapper>
       <page_header metal:define-slot="page_header"/>
       <wrapper>
         <content metal:define-slot="content"/>
       </wrapper>
     </wrapper>
     <page_footer metal:define-slot="page_footer"/>
   </main>
</layout>
---

pt_2: The main template
---
<page metal:define-macro="page">
   <metadata/>
   <body>
      <layout metal:use-macro="here/pt_1/macros/layout">
        <page_header metal:fill-slot="page_header">Header</page_header>
        <content metal:fill-slot="content">Content</content>
        <page_footer metal:fill-slot="page_footer">Header</page_footer>
      </layout>
   </body>
</page>
---

This way, I can switch to a different layout by using a different layout 
macro (and stylesheet).

This is a silly example, but I hope you get the idea.

I have seen a related technique in Plone templates:

---
<div metal:fill-slot="foo">
   <div metal:define-slot="foo"/>
</div>
---

Tonico



More information about the Zope3-dev mailing list