[Zope3-Users] Changing "homepage" view/content
stbru at teksavvy.com
Sun Aug 21 16:56:41 EDT 2005
Stéphane Brunet wrote:
> I was wondering how to change the homepage view, just like in the
> worldcookery.com website (In fact, I installed the "wcsite" package to
> try it). On the official site, cliking on the "Home" (or top) link
> goes to a welcome page containing customized content rather than on
> the default list of objects contained in the top folder.
> How can I reproduce this behaviour on my own site ?
> Thank you!
Answering to my own question: it is just a matter of configuration…
The code of Worldcookery.com website (see wcsite-1.1.tgz in the download
area) adds a view in order to provide a more specific interface,
IWCSite, to the top folder which provides ISite interface. The
configure.zcml file for the whole package contains the following part:
which links to the following piece of code in browser.py file:
site = removeSecurityProxy(self.context)
directlyProvides(site, IWCSite, providedBy(site))
So when invoking e.g. http://localhost:8080/makeWCsite.html, the
makeWCSite function adds the IWCSite interface to the list of interfaces
provided by the top folder (look at the introspector view of the top
folder before and after).
Thanks to the other part of configure.zcml for the whole package :
a custom view for the IWCSite objects is registered. The site.pt file
does the rest of the job.
I hope that it can help other newcomers like me... ;-)
Any idea how to the same in a more generic way ?
More information about the Zope3-users