Skip to content. | Skip to navigation

Sections
Personal tools
You are here: Home News & views Forcing viewlets to order properly.

Posted Feb 10, 2009

Forcing viewlets to order properly.

by Eric Steele
— filed under:

From the Department of Putting-this-out-there-so-someone-doesn't-have-to-spend-an-hour-fighting-with-the-same-problem.

Recently, I ran into issues defining the placement of a new viewlet I'd created. The GenericSetup viewlet tag has "insert-before" and "insert-after" attributes that didn't seem to be working as I'd thought they would.

When I attempted

<order manager="plone.htmlhead" skinname="*">
  <viewlet name="glowormHtmlHeadIncludes" insert-after="plone.resourceregistries" />
</order>
my viewlet wasn't showing up where expected.

 

So instead, to get it to work properly, I wound up having to relist the existing viewlet I wanted it to be placed after.

<order manager="plone.htmlhead" skinname="*">
    <viewlet name="plone.resourceregistries" />
    <viewlet name="glowormHtmlHeadIncludes" />
</order>

 That's it. Hope that helps.

Document Actions

Re: Forcing viewlets to order properly.

Posted by David Glick at Feb 10, 2009 11:31 AM
Hmm. This exposes a limitation in GS viewlet support. The problem with the way you ended up doing it is that if there's some *other* product already installed that *also* depends on having a viewlet ordered after plone.resourceregistries, its position will get clobbered. It seems there's no good way for multiple products to affect the viewlet ordering in a deterministic fashion. :-[
Need help now?

Immediate assistance is available during university work hours:

News & views…
Posted Oct 13, 2009 Portlets gone wild with ContentWellPortlets 2.0.1 This new release adds the ability to add portlets to the footer area. It also has 6 portlet managers per area. This means 20 total portlet managers including the 2 on the sides that ship with plone.
Posted Sep 17, 2009 Plone 4 – An interview with Zope News Jan Ulrich Hasecke interviews me for Zope News.
Posted Aug 31, 2009 Web Services API for Plone Alpha 3 Release Details the release of the wsapi4plone.core package and the plans for future releases. The final report of the AtomPub for Plone Google Summer of Code project.
Posted Aug 28, 2009 Content editing and creation in Plone is faster with archetypes.schematuning Some bench marks of content editing and creation in Plone with and without archetypes.schematuning installed.
More news & views…