[Zope3-dev] Macro vs. Pagelet

Jean-Marc Orliaguet jmo at ita.chalmers.se
Mon Dec 13 14:29:41 EST 2004


Tonico Strasser wrote:

> Jean-Marc Orliaguet wrote:
>
>> Tonico Strasser wrote:
>>
>>> 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?
>>>
>>> Tonico
>>>
>>
>> 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.
>
>
> Sure, completly different.
>
> Until now I thought I won't need pagelets because I can get most of my 
> job done with macros and Python scripts, after I realized that macros 
> cannot connect to interfaces (of course).
>
> Without interfaces I can't see a use case for pagelets in my Web 
> projects. YMMW.
>
> Tonico


Hi,

I have started porting the patterns used in CPSSkins (Zope2) to Zope3 
with some adjustments.
This is mainly for me to learn how zope3 works.

That is the approach being used:

- you start from a Theme (a container).

A Theme contains a Pagelets (Page Elements) -- and Styles, Palettes, etc.
 - pagelets are used to describe the layout: these are the node elements 
(ordered containers)
 - pagelets are used to describe the contents of the layout: these are 
the leaf elements (simple items).

PAGE LAYOUT (the "node" Pagelets)
- a Page is composed of vertical Blocks, a.k.a Page Blocks that are 
ordered containers themselves.
- Page Blocks contain Cells ("horizontal" layout).
- Cells contain Templets (or Pagelets as they will be renamed). They are 
ordered vertically inside Cells.

Ordering is used because the elements on a page are logically ordered. 
Switching between vertical and horizontal ordering allows you to create 
just any layout.

Typically, layouts are rendered using HTML, but they can be rendered in 
other format (e.g. XML), etc. ESI (edge-side-includes directives)

PAGE CONTENTS (the "leaf" Pagelets):
- A Pagelet can be a component that posseses all the information it 
needs to be displayed (in its own schema).
- A Pagelet can be a Slot - in that case it will be used as a proxy to 
render other components (for instance portlets, documents, page contents)
  the idea is basically to delegate the responsibility for doing the 
rendering and managing the logic to third-party applications.
  The Slot is identified using a slot name.

STYLES
- Pages and layout elements (Page Blocks, Cells) and page contents can 
be assigned Styles to.

- A Style is a collection of properties (colors, border styles, layout 
properties, i.e. padding, margin, widths, heights...) .
They are typically rendered using CSS, but it should also be possible to 
implement such features as elements visibility in python.

- Styles are modifiers: they modify the appearance, the visibility of 
the page elements. The idea is to not assume too many things about the 
properties to assign to the page elements from the beginning, but 
instead to connect styles to them when needed (page elements should have 
very basic schemas)

SCRIPTS
- ... register javascript scripts here. Like Styles, Scripts can be 
assigned to a whole Theme, a Page elements, pagelets, etc.

PALETTES
- palettes are simply field entries (colors, border styles, etc...) that 
can be used in Styles, they are simple place-holders for field values. 
Styles use Palettes but Palettes ignore everything about Styles.

RENDERERS
render the page elements (HTML renderer, XML, ESI) and the Style elements

RAM CACHE
- a utility to cache any of the elements above, based on the logic of a 
web application (some elements change often, some almost never change).

...

/JM



More information about the Zope3-dev mailing list