Hi, On Fri, Sep 28, 2007 at 05:33:56PM +0800, Yuan HOng wrote: > On 9/28/07, Frank Burkhardt <[EMAIL PROTECTED]> wrote: > > > > > 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. > > > > Thanks, that works. So all was missing is the '@@' notation to tell > TALES to look up a view for Book. > > > 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. > > > > If not object/@@view, what then? A custom traverse to lookup the > Multiview maybe?
You could use a view as dispatcher which then would be traversed like object/@@view: class MyDispatcher(object): def __call__(self): realview=zapi.getMultiAdapter((self.context,self.context.__parent__,self.request)) return realview() class MyExampleView(object): def __init__(context,parent,request): self.context=context self.parent=parent self.request=request def __call__(self): return "Book/shelf-specific html" *configure.zcml* <configure> <browser:page for=".interfaces.IMyBook" name="view" class="MyDispatcher" ... /> <zope:adapter for=".interfaces.IMyBook .interfaces.IMyShelf IBrowserRequest" ... /> </configure> Regards, Frank _______________________________________________ Zope3-users mailing list Zope3firstname.lastname@example.org http://mail.zope.org/mailman/listinfo/zope3-users