Diazo theming and portlet rendering

I have a Plone 4 site which includes a Diazo theme package. This includes responsive versions of existing portlet template files. This is working as expected, but when I try and view the site without any Diazo theming applied, I am still seeing versions of the portlets rendered using the templates from the Diazo theme package. The methods I have tried using to disable Diazo are:

  • appending diazo.off=1 to the end of the URL
  • replacing localhost with (since the latter is listed in 'Unthemed host names' within the Plone control panel)

Both of the above methods successfully render the site without Diazo, but the responsive portlets are still being rendered. The only way I have managed to view the original portlets which haven't had any of the styles applied from the Diazo theme is by going to Theme settings in the Plone control panel, and changing the default theme to the one which doesn't use Diazo.

Does anyone know if this is a bug, or is it expected behaviour and I'm misinterpreting the meaning of the diazo.off parameter and the unthemed host name setting.



I believe that what you are seeing is the expected behavior and not a bug. Here's why:

Diazo themes have two levels at which they apply changes. The first, and most obvious one is where they transform the HTML produced by Plone into the HTML of your theme. This level is the one controlled by your theme rules.xml file and is the level disabled by either of the approaches you list above.

The second level at which Diazo can apply changes is by overriding (replacing) one or more page templates from Plone that are responsible for determining how the HTML that Plone produces will look. You state above that your theme includes "responsive versions of existing portlet template files". These files operate on the second level, which is to say that they change the HTML that Plone produces before it is transformed by rules into your theme HTML.

Because the application of these template overrides happens when a theme is activated, the changes they produce will be present unless you deactivate the theme entirely.

Think of the and/or diazo.off tricks as being related to hiding the transformation of Plone's HTML into your theme HTML.

Think of the overriding of templates as being responsible for changing the HTML produced by Plone in the first place.

Like this:

page templates ----> Plone HTML ----> rules.xml ----> Diazo theme HTML

Does that help your understanding of what is happening here?


When you say "This includes responsive versions of existing portlet template files". How does it include them? What method are you using include template files? unfortunately its a little confusing as there are many kinds of template files in plone now.

Thanks for the explanation @cewing, that helps me understand what's going on here. I didn't realise that Diazo operates at two levels, but this would explain what I'm seeing. In summary:

  • I can prevent the transformation of the HTML produced by Plone into the HTML from my Diazo theme by using either diazo.off=1 or accessing my site through a hostname in the 'Unthemed host names' list. This corresponds to steps 2-4 (Plone HTML ----> rules.xml ----> Diazo theme HTML).

  • I can only change the underlying page templates which are used to render the final HTML by switching to a different theme.

In my Diazo-based theme package, I have a portlets/configure.zcml file which overrides the portlet rendererers defined in my base theme package. This causes the particular portlets in question to be rendered using different .pt template files (in this case, responsive ones).

If there's a different (easier? better?) way of doing this then please let me know.

For some background info, the reason I have two different themes, one based on Diazo which makes the site responsive, and another base theme which isn't responsive is that currently, site editors are making edits to the site via a different URL (defined in the unthemed hostnames file). It was decided that it'd be simpler to focus on making the public-facing, non-editable version of the site responsive, while leaving the one which our internal users make edits on non-responsive.

1 Like

Just to clarify. Diazo only transforms plone html once.
What you are doing is combining two different forms of theming which is perhaps why its confusing.
ZCML overrides use one mechanism to make it theme specific (called a layer) and diazo uses another way.
We personally avoid overriding views or plone templates via zcml. In most cases you are overriding a lot more than just the small chunk of html you want to change which makes upgrades hard. We try to do everything in diazo, or using a combination of TTW programming (like with rapido/plomino/listingviews and diazo). Once you learn a bit of XSLT you will find in most cases you can transform the base plone html without having to override the template.
If you do really want to override the template. Then likely you need to look at how you are using layers and need to realise that activating an old style theme is different than activating a diazo theme and they effectively act independently.

1 Like

If the reason for this is to edit the site without diazo, you could consider theming two URLs differently, for example by using zettwerk.mobiletheming (just disable the javascript in /portal_javascript or use a non existing URL in the control panel.)
It should be possible to override the templates with jbot in the diazo theme, preventing them from beeing used elsewhere... Thats said: I am pretty sure you can do the responsive part in CSS files in the theme (and only there),