Hi, I thought this would be a simple case for Zope3, but after one whole day I am not able to find a clean solution. Must be missing something.
Suppose I have a BookShelf which contains lots of Books. The view for BookShelf will show a list of Books contained in the shelf, and when the user click on a book, a detailed view for the Book will be opened. Of course the Book rendered in the shelf will be different from the same rendered in the book detail view. But how best to achieve this in zope3? The triditional solution (zope 2) I am familar with would be to use <tal:repeat> in the page template for the shelf like this: <div tal:repeat="book shelf/books"> <h3 tal:content="book/title" /> <p tal:content="book/auther" /> ... </div> This however mixes the presentation of the shelf itself with the books on the shelf. If I want to change how books looks like on the shelf, I have to modify the shelf template, which doesn't seem to be a good separation of concerns. 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? 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. Thanks for any suggesions as to in what direction I shall research. -- Hong Yuan 大管家网上建材超市 装修装潢建材一站式购物 http://www.homemaster.cn
_______________________________________________ Zope3-users mailing list Zope3-users@zope.org http://mail.zope.org/mailman/listinfo/zope3-users