I’ve started work in earnest on theming a Plone 3 site this week and have come up against some minor annoyances. But, this was balanced out by some of the cool things I learned too.
Portlets.xml
One of the great things about generic setup is that you can configure your site through the web and then export your settings as a series of xml files to your filesystem theme product. However, configuring my portlets and then exporting the resulting portlets.xml file caused some problems when re-installing the product.
I’d customised my navigation following the steps outlined in the article Customising navigation in Plone 3. This was fine. But when I re-installed my theme product containing an exported portlets.xml file I got a “ConstraintNotSatisfied” error. I didn’t get very far with finding a solution to this on Google, but by trial and error found out that this disappeared if I removed the following from the <assignment name=”navigation” …/> directive:
<property name=”name” />
<property name=”bottomlevel”/>
<property name=”root” />
Secondly, default portlets (login, news, recent etc.) I’d removed via “manage portlets” weren’t reflected in my portlets.xml file so I had to enter this manually into my portlets.xml file:
<assignment remove=”true” name=”login” category=”context” key=”/”
manager=”plone.leftcolumn” type=”portlets.Login” />
<assignment remove=”true” name=”calendar” category=”context” key=”/”
manager=”plone.rightcolumn” type=”portlets.Calendar” />
<assignment remove=”true” name=”events” category=”context” key=”/”
manager=”plone.rightcolumn” type=”portlets.Events” />
<assignment remove=”true” name=”news” category=”context” key=”/”
manager=”plone.rightcolumn” type=”portlets.News” />
<assignment remove=”true” name=”recent-items” category=”context” key=”/”
manager=”plone.rightcolumn” type=”portlets.recent” />
<assignment remove=”true” name=”review-list” category=”context” key=”/”
manager=”plone.rightcolumn” type=”portlets.review” />
CSS Registry
To ensure that the order of CSS files in the CSS Registry was honoured I had to enable the auto grouping property (which didn’t exist in Plone 2.5.3). In the cssregistry.xml you can set this via:
<object name=”portal_css” meta_type=”Stylesheets Registry” autogroup=”True”> … </object>
The order seemed to go a bit haywire again if I enabled debug mode in the CSS Registry.
More positive things
It’s pretty straightforward to override viewlets for different content types. For instance, I didn’t want the breadcrumb trail to appear on my home page. In my browser/configure.zcml I simply added this directive:
<browser:viewlet
name=”bbkschool.path_bar”
manager=”plone.app.layout.viewlets.interfaces.IContentViews”
for=”Products.BBKHomePage.interfaces.IBBKHomePage”
layer=”.interfaces.IThemeSpecific”
template=”nopath_bar.pt”
permission=”zope2.View” />
In the “for” attribute I specify the interface of the content type I want this to apply to. The template, “nopath_bar.pt” is simply an empty template in my browser directory.
Lastly, Gloworm came in really handy as did plone.reload (although I found this a little unpredictable at times).