AW: [Zope3-Users] pagelets vs. pages

2007-06-27 Thread Roger Ineichen
Hi Stephan, Herman

> Betreff: Re: [Zope3-Users] pagelets vs. pages
> 
> On Tuesday 26 June 2007 12:46, Hermann Himmelbauer wrote:
> > At first, thanks for your reply, this clears things up a 
> lot for me. 
> > The link to the Blog-entry above was also very valuable.
> 
> Great!
> 
> > What I still don't understand is how to implement a simple, 
> > quasi-static html-page. With browser:page I'd do it like this:
> >
> >    >       name="index.html"
> >       for="myapp.interfaces.IMyApp"
> >       template="index.pt"
> >       layer="swarmfinder.layer.IMyAppLayer"
> >       permission="zope.Public"
> >       />
> 
> I'll note that Zope 3 does a lot of black magic to make this 
> directive work correctly.
> 
> > And the template "mypage1.pt" would e.g. use the "body" 
> macro and have 
> > some static content.
> 
> Right.
> 
> > In case of pagelets, I'd do it like this (correct me if I'm wrong):
> >
> >    >       for="*"
> >       name="index.html"
> >       permission="zope.View"
> >       class=".MyAppPage1"
> >       layer="z3c.layer.pagelet.IPageletBrowserLayer"
> >       />
> >
> >      >       for=".MyAppPage1"
> >       layer="z3c.layer.pagelet.IPageletBrowserLayer"
> >       template="mypage1.pt"
> >       />
> >
> > And then I'd have to implement an interface and a class:
> >
> > class IMyAppPage1(zope.interface.Interface):
> >   pass
> >
> > class MyAppPage1(BrowserPagelet)
> >   implements(IMyAppPage1)
> >
> > This is a lot more code than with the browser:page example.
> > As a solution, I'm thinking about a magic "template" 
> directive in the 
> > z3c:pagelet namespace, e.g. something like that:
> >
> >    >       for="*"
> >       name="index.html"
> >       permission="zope.View"
> >       template="mypage1.pt"
> >       layer="z3c.layer.pagelet.IPageletBrowserLayer"
> >       />
> 
> This example is longer than it needs to be. For starters, you 
> do not need the interface; in your example it serves no use. 
> Optionally, if you do not need to keep template registration 
> independent of view registration, the following will work as well:
> 
> class MyAppPage1(BrowserPagelet):
> template = viewpagetemplatefile.ViewPageTemplateFile('mypage1.pt')
> 
>  for="*"
> name="index.html"
> permission="zope.View"
> class=".MyAppPage1"
> layer="z3c.layer.pagelet.IPageletBrowserLayer"
> />


Please don't use the z3c.viewtemplate package.

You can use the z3c.template package which offers
you a much better separated concept.

z3c.template and z3c.macro replaces the z3c.viewtemplate
package.

Regards
Roger Ineichen

___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] pagelets vs. pages

2007-06-26 Thread Stephan Richter
On Tuesday 26 June 2007 12:46, Hermann Himmelbauer wrote:
> At first, thanks for your reply, this clears things up a lot for me. The
> link to the Blog-entry above was also very valuable.

Great!

> What I still don't understand is how to implement a simple, quasi-static
> html-page. With browser:page I'd do it like this:
>
>          name="index.html"
>       for="myapp.interfaces.IMyApp"
>       template="index.pt"
>       layer="swarmfinder.layer.IMyAppLayer"
>       permission="zope.Public"
>       />

I'll note that Zope 3 does a lot of black magic to make this directive work 
correctly.

> And the template "mypage1.pt" would e.g. use the "body" macro and have some
> static content.

Right.

> In case of pagelets, I'd do it like this (correct me if I'm wrong):
>
>          for="*"
>       name="index.html"
>       permission="zope.View"
>       class=".MyAppPage1"
>       layer="z3c.layer.pagelet.IPageletBrowserLayer"
>       />
>
>            for=".MyAppPage1"
>       layer="z3c.layer.pagelet.IPageletBrowserLayer"
>       template="mypage1.pt"
>       />
>
> And then I'd have to implement an interface and a class:
>
> class IMyAppPage1(zope.interface.Interface):
>   pass
>
> class MyAppPage1(BrowserPagelet)
>   implements(IMyAppPage1)
>
> This is a lot more code than with the browser:page example.
> As a solution, I'm thinking about a magic "template" directive in the
> z3c:pagelet namespace, e.g. something like that:
>
>          for="*"
>       name="index.html"
>       permission="zope.View"
>       template="mypage1.pt"
>       layer="z3c.layer.pagelet.IPageletBrowserLayer"
>       />

This example is longer than it needs to be. For starters, you do not need the 
interface; in your example it serves no use. Optionally, if you do not need 
to keep template registration independent of view registration, the following 
will work as well:

class MyAppPage1(BrowserPagelet):
template = viewpagetemplatefile.ViewPageTemplateFile('mypage1.pt')



In our experience, we rarely do static pages, maybe one every 20-30 other 
views. Then, we purposefully did not provide the semantics of the 
browser:page directive, because we *want* transparency. So why optimize this 
rare use case at the cost of losing transparency?

> Perhaps in case of this "template" directive, the interface/view class
> could be created on the fly? What do you think?

No, one of the (maybe implicit) goals of pagelets is to require view classes 
and get rid of the class building magic.

Regards,
Stephan
-- 
Stephan Richter
CBU Physics & Chemistry (B.S.) / Tufts Physics (Ph.D. student)
Web2k - Web Software Design, Development and Training
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


Re: [Zope3-Users] pagelets vs. pages

2007-06-26 Thread Stephan Richter
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
>  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 
 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
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users


[Zope3-Users] pagelets vs. pages

2007-06-26 Thread Hermann Himmelbauer
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.

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

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?

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  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?

I also don't fully understand the advantage of a pagelet over a page/view: Why 
is it important that the layout is customizable for every view? Isn't it 
common that a skin and therefore the layout is the same in the entire 
application?

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

Is that true?

Best Regards,
Hermann

-- 
[EMAIL PROTECTED]
GPG key ID: 299893C7 (on keyservers)
FP: 0124 2584 8809 EF2A DBF9  4902 64B4 D16B 2998 93C7
___
Zope3-users mailing list
Zope3-users@zope.org
http://mail.zope.org/mailman/listinfo/zope3-users