[Zope3-dev] Macro vs. Pagelet
Dominik Huber
dominik.huber at projekt01.ch
Tue Dec 14 05:36:56 EST 2004
>> I think I now finally understand the difference between a macro and
a
>> pagelet :)
>>
>> A pagelet is a reuseable page component that can connect to
>> a page via
>> interfaces and vice versa. Is that correct?
>>
>I think that these are basically two different approaches: one is the
>web developer approach (macros) the other is the application
developer
>approach (pagelets). The latter has a higher abstraction level since
>rendering to HTML/XML ... comes last, almost as a feature.
>With macros
>the final rendering comes first.
or paglets may introduce an 'logical' interface between the actor web
developer and the actor
application developer too.
in roger's zope.app.paglet implementation the application developer
register a
specific pagelet-data adapter for the content type. against this
pagelet-data interface
the web developer writes its page templates*.
I never worked with that package but that's what I got out of my
questioning.
Regards,
Dominik
*an example from zope.app.demo.paglet:
page-data .interfaces (interface between app dev. and web dev.):
class IDemoPageData(Interface):
"""A sample content type for to test pagelet."""
title = TextLine(
title=_(u"Title"),
description=_(u"Title of the sample"),
default=u"",
required=False)
description = Text(
title=_(u"Description"),
description=_(u"Description of the sample"),
default=u"",
required=False)
pagelet template .browser.demo_pagedata_pagelet.pt (3 -> lookup
page-data,
8 -> use page-data within the template):
...
1 <div class="row"
metal:define-macro="demo_pagedata_pagelet_macro">
2 <tal:block
3 tal:define="data
pagedata:zope.app.demo.pagelet.interfaces.IDemoPageData">
4 ...
5 <h6>Content: title</h6>
7 <span tal:content="data/title">title</span>
8 </tal:block>
9 </div>
...
More information about the Zope3-dev
mailing list