You are here: Home / What do you need? / Help and documentation / Plone Info / Viewlets, overriding and creating new ones

Viewlets, overriding and creating new ones

by Darrell Kingsley last modified Mar 13, 2014 02:22 PM
Some info which may be useful when they're really not playing ball.

When you've hidden a viewlet and want to get it back, you've got to add the following directive to viewlets.xml

 <hidden manager="plone.belowcontent" skinname="*">
  <viewlet name="plone.comments" remove="True" />

I'll put some more useful stuff in here later.

Problems with plone.comments

I've had a few problems with viewlets not showing up, or giving errors. I tried to replace plone.comments with a new version of it. I got errors from variables in the template, even though they worked in the original template which I had just copied.

However, there's an issue with the "layer" bit of the configure.zcml, which might mean that it doesn't get hold of the right context from which to grab the variables. There are also complicating factors caused by the browserlayer.xml file which is also in the theme, which may prevent the viewlet from showing up in the right circumstances.

At some point I have to work through the relevant examples from the Plone site and find out why I was finally able to replace the template with a different one, when I recopied them all. Why the new version didn't appear on RWSAC until I reinstalled the theme, whereas on SAL and BB it worked without a reinstall of the theme.

For reference, the reason plone.comments does not include the comments form, which is what I was trying to do, is because the form has to sit on a control template (cpt) as it has verification and a metadata-controlled action. This means that it has to be linked to the separate discussion_reply.cpt template. I took that code and embedded it on the two relevant blog views so the code was there and then hid the plone.comments code on those pages.

Some useful links