On Tue, 2007-07-17 at 08:45 +0200, Hermann Himmelbauer wrote:
> Am Montag, 16. Juli 2007 22:44 schrieb Stephan Richter:
> > On Monday 16 July 2007 15:58, Benji York wrote:
> > > This reminds me of something I've been curious about but haven't had
> > > time to research lately.  What are the differences between pagelets and
> > > viewlets and their various strengths/weaknesses.  An acceptable answer
> > > is "read the docs and decide for yourself". <wink>


> That leads me to the question if it's possible to mix pagelets/viewlets? In 
> my 
> case, I have one main content area but I have some dynamic code, e.g. a 
> navigation box, a login box, later perhaps a search box etc. How would I 
> implement them? Perhaps I use a viewlet manager / viewlet in the layout 
> template?

I recommend reading the README's of z3c.template and z3c.pagelet (and
z3c.macro for good measure). Also study of z3c.formdemo teaches much
about the patterns developed in the z3c packages.

But I think I can answer your question.

1. Register a layout template to your layer using z3c:layout (see
z3c.formdemo/skin for an example)
2. It could contain:

<tal:block replace="structure provider:leftcol" /><!--dynamic code -->
<tal:block replace="structure provider:pagelet" /><!-- content area -->
<tal:block replace="structure provider:rightcol" /><!--dynamic code -->

3. left and right columns are your own viewlet managers registered with
4. `pagelet` is special, you can register a view using z3c:pagelet (and
a template for it with z3c:template) and the `pagelet` provider will do
the rest.

This pattern is used in z3c.formdemo.

Hope this helps.

> Best Regards,
> Hermann

Zope3-users mailing list

Reply via email to