[Zope3-dev] Re: Portlets vs Pagelets

Tonico Strasser contact_tonico at yahoo.de
Mon Dec 6 17:01:46 EST 2004


Garrett Smith wrote:
[...]
> 
> To reiterate my earlier observation, we already have a number of
> page-construction facilities/patterns. What are the major problems with
> the current system that need to be addressed?

One thing I'd really like to have is an easy way to attach names to 
templates.

Example:

Template A:
---
<title tal:content="title">
<ul metal:use-macro="macros/navigation"/>
---

Template B:
---
<ul metal:define-macro="navigation">
   <li tal:repeat="item navigations/main"
       tal:attributes="class item/selected">
     <a tal:attributes="href item/url;"
        tal:content="item/title"/>
   </li>
</ul>
---

IOW: I'd like to get rid of 'tal:define' and define names elsewhere, 
e.g. in a simple Python script:

Script A:
---
names = {
     'title': 'A dummy page',
     'macros': getMacrosDictFromSomewhere(params),
     ...
     }
return names
---

Script B:
---
names = {
     'navigation': creepyNavigationScript(),
     }
return names
---

I can do this in Z2 but it's not easy for me.

The benefits are:

   * better separation of logic and presentation

   * improved reuseability of templates

   * cleaner templates through less code are better for newbies

Moveabletype uses "template tags". That makes things very easy for 
template designers:
   <http://www.movabletype.org/docs/mtmanual_tags.html>

Tonico



More information about the Zope3-dev mailing list