preload
Mar 13

Most of the time when I skin a Plone site for a client they want to clear out all of Plone’s stock portlets and only display ones that they can manage the content of. I quite often use the SimplePortlet Product to achieve this. It is simple, stable, and user friendly.

With SimplePortlet not every page has to have a portlet, you can define it with a boolean True or False checkbox. One feature that SimplePortlet does not have is the ability to hide the left or the right slots if there is no portlet to be displayed. I found a way to do this with one small change:

In the main_template.pt find the block that starts with <tal:comment replace=”nothing”> Start of left column </tal:comment> mine is around line 108.

Change this:

<td id=”portal-column-one”
metal:define-slot=”column_one_slot”
tal:condition=”sl”>

To this:

<td id=”portal-column-one”
metal:define-slot=”column_one_slot”
tal:condition=”python:here.portlet_manager.getPortlets(here, ‘columnOne’)”>

Scan down and locate <tal:comment replace=”nothing”> Start of right column </tal:comment>

Change this:

<td id=”portal-column-two”
metal:define-slot=”column_two_slot”
tal:condition=”sr”>

To this:

<td id=”portal-column-two”
metal:define-slot=”column_two_slot”
tal:condition=”python:here.portlet_manager.getPortlets(here, ‘columnTwo’)”>

I belive the sl and sr checks for if there are portlets for ‘slot left’ and ‘slot right’ respectively. If you plan to use this with other portlets you may want to put boolean ‘or’ in there.

btw: I am in NO WAY LIABLE for ANY DAMAGE you might do to your Instance by messing around with the things I describe here. Always backup!

Leave a Reply

You must be logged in to post a comment.