[Zope3-Users] pagelets vs. pages

Stephan Richter srichter at cosmos.phy.tufts.edu
Tue Jun 26 09:37:58 EDT 2007


On Tuesday 26 June 2007 08:42, Hermann Himmelbauer wrote:
> Hi,
> It seems that the z3c.formdemo examples are based on pagelets, as they seem
> to perfectly integrate with z3c.form. Therefore I had a look at it and
> moreover at z3c.layer.pagelet, which is a minimal skin for a pagelet based
> application.

Yes, we developed this base layer for use with pagelets.

> What I don't fully understand is if a pagelet-based design/skin replaces
> macro-based skins.

Yes it does.

> I understand pagelets in a way, that they separate content and layout,
> whereas layout means "everything around the content", e.g. Header, Logo,
> Toolbar, Navigation etc. - is that true?

Yes, so pagelets in that sense are most useful to sites and applications that 
have a well-defined conent area. Other sites, mostly portals (for example 
www.lovelybooks,de) do not have one main content. Lovelybooks uses a pure 
viewlet-based design.

> Moreover I assume that every pagelet requires a view class that is based on
> the class "BrowserPagelet". However, a simple HTML-page, e.g. an
> "Intro"-Page or the like does not require any view, therefor I'd rather
> implement it via a simple page template and register it via the
> <browser:page ...> directive. But how would I use my layout templates in
> this case? Or do I have to write a dummy class for this page, assign
> acontent template and register it as pagelet?

Pagelets are a different way to do UI design with Zope 3. The default 
directives don't serve new UI patterns well. Unfortunately, the 
<browser:page> directive does a lot of magic that is incompatible with the 
API requirements of pagelets. So you have to do pagelets all the way.

> I also don't fully understand the advantage of a pagelet over a page/view:

Pagelets are just pages/views, just done differently.

> Why is it important that the layout is customizable for every view?

Because it is a requirement that we commonly observe. For example, most sites 
have a front page (first tier) and secondary pages (second tier) that often 
have very different layouts.

> Isn't 
> it common that a skin and therefore the layout is the same in the entire
> application?

No.

> So perhaps the decision if to use pagelets or not boils down to the
> following issues:
>
> 1) If you need different layout throughout your application, use pagelets
> 2) If not, use browser pages / views and skin macros

I disagree. Macros have several other disadvantages. For example, they often 
require variables to be defined before you can call a macro. Those 
requirements are not documented or formally declared anywhere, making it very 
hard for people to work with them. Viewlets (including the pagelet variant) 
allow you to specify the API available to the template using common 
mechanisms, in other words interfaces.

View Templates, which is a predecessor of pagelets but still have a unique 
reason for existence, allow you also to work much better with designers.

I think you will find the following read interesting, which was written 
pre-pagelet:

http://www.lovelysystems.com/srichter/2006/09/20/the-skin-browser-and-lovely-systems-new-development-workflow/

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training


More information about the Zope3-users mailing list