Customizing the viewlets in main_template

Since Plone 3.0, main_template.pt calls viewlet managers instead of METAL macros. Learn from this tutorial how viewlets can be programmatically reordered, hidden or added (from a product on the filesystem).

  1. Introduction What this tutorial is about
  2. Viewlet registration in Plone 3.0 How viewlets are registered in a default Plone installation.
  3. Reordering and Hiding viewlets How to simply change the viewlets behavior from a Generic Setup Profile.
  4. Adding a viewlet How to add a viewlet and still have several skins living in peace.
  5. Overriding a template viewlet How to use Zope 3 technology to override a viewlet with template definition.
  6. Overriding a class viewlet How to use Zope 3 technology to override a viewlet with class definition.
  7. Moving a viewlet from a viewlet manager to another one The title says it all…

All content on one page (useful for printing, presentation mode etc.)

 

Advantages

Posted by Marco Souza at Sep 19, 2007 12:11 AM
Why do not touch on the main_template is better?

I think the old method sufficiently flexible..

Does viewlets require Zope's restart?

Disadvantages

Posted by Martin Aspeli at Sep 30, 2007 01:15 AM
You can of course customise main_template still, but when you do so you're on your own. You are more likely to have difficulties upgrading to newer versions of Plone, and you may find that some third party products or parts of Plone don't work as intended if you're not careful in preserving the relevant macros/slots/CSS classes/ids. Viewlets give you a more formal, controllable way of modifying UI elements. Of course, it's sometimes necessary to customise main_template as well.

You don't need to restart to make changes in page templates, but you do need to restart when you change Python or ZCML.

Uninstall

Posted by Christoph Handel at Mar 10, 2008 07:07 PM
I created a blank basic skin using the generator of DIYPloneStyle version 3.0 and including the viewlet example. Installing this example will add a viewlet to the portal footer ("Yay! Wh00t!"). But uninstalling the skin will leave the viewlet there...

Re: Uninstall

Posted by unset at Oct 15, 2008 02:39 PM
I'm not an expert in Plone, but I had a similar problem. I have tested the ZEO with a DIYPloneStyle theme.
Then I configured in the DIYPloneStyle product directory browser/configure.zcml and deleted the browser:viewlet section. Then I reinstalled the product but the viewlet was still there. So I restarted the clients and the viewlet wasn't there anymore.

here is chinese edition of the tutorials ...

Posted by adam tang at Apr 23, 2008 02:42 PM