[Zope3-Users] How to register multiple view for the same content
class
Frank Burkhardt
fbo2 at gmx.net
Fri Sep 28 04:20:26 EDT 2007
Hi,
On Fri, Sep 28, 2007 at 03:19:10PM +0800, Yuan HOng wrote:
[snip]
> Is it possible to register two different views for the Book, one for
> display in shelf, another for the detailed view? The one for the
> detailed view is simply a BrowerPage, but how to do the book-in-shelf
> view?
Exactly the same way.
> I'd like for my shelf template to look something like this:
>
> <div tal:repeat="book shelf/books">
> <div tal:replace="structure book/in-shelf-view />
> </div>
>
> Then I can maybe register different in-shelf-view's for different type
> of shelves.
>
> I tried registering a browser:view named 'in-shelf-view' for IBook. It
> doesn't work, because TALES doesn't know about the view.
You just need another browser:page here. Name it 'in-shelf-view' and
use something like
<div tal:replace="structure book/@@in-shelf-view" />
to embed it.
Registering the view for different "shelves" is possible, too. But this not
a simple view anymore - it's a "Multiview". You need an adapter for
(book,shelve,request) to do that which means, a simple browser:page won't
work and you'll be not able to use the object/@@view notation for that.
Regards,
Frank
More information about the Zope3-users
mailing list