[Product-Developers] Best way to generate custom frontpage

Dave Turvene dave at dahetral.com
Tue Jan 27 17:14:36 UTC 2009

For years, I have been using a fairly complex ZPT to generate a custom frontpage
hitting the catalog and formatting recent news, recent blog entries, a prose
area from an ATDocument Cookedbody(), etc.  Over time, the ZPT has become too
complex.  Spurred on by the way-cool Professional Plone Development book, I
started working on moving my sites to Plone3-ish concepts.

I tried creating a BrowserView
subclass and stick all the gnarly stuff into it and defining it as a
browser:page in configure.zcml.  That works great when I do ``site/myfrontpage``
or ``site/@@myfrontpage``, and is MUCH easier than my old nested
tal:define/tal:repeat/tal:define oddness.  But when I try to set the
``default_page`` property to it, I get what looks like a reference to the class
instance itself, not a rendering.  After hacking around some, I ended up using a
mypolicy/profiles/default/types/Plone_Site.xml file with an additional
view_method value for my browser view.

My questions:

* Why do I need to add the BrowserView class to Plone_Site.xml to make this
work?  Should I define my BrowserView as a browser:view for this?  It seems like
folder.xml has view_methods also.  Is it possible to develop a MyFrontPage.xml
file with the desired FTI information in it (that would be cool, then it would
be isolated?)

*  More importantly, is this the best way to implement this?  It seems like I
can do something like this with a viewlet.

* Finally, what is the best scope for MyFrontPage?  Currently I have use
``for="*"`` but is it preferable to use something like
Products.CMFCore.interfaces.ISiteRoot?  BTW, if that sounds like a dumb
question, I understand I need to look more at what this clause does.

I apologize for the long question(s) but this, I believe, can be a valuable
recipe if done correctly.


More information about the Product-Developers mailing list