Can a Plone viewlet be made to appear on one page or folder only?
Plone's viewlets appear to be sit开发者_运维技巧e-wide by default. How can I make a viewlet only appear on a certain page?
This is done with Theme Interface in Plone. Check this documentation:
http://plone.org/documentation/manual/theme-reference/buildingblocks/components/themespecific
If u created your Theme / viewlet with a paster template, all should be in place and ready to use.
In addition to theme-specific viewlets, mentioned by @user276028, you can create browserlayers for non-theme viewlets:
Example taken from collective.atimage.transformtoolbar:
Create a browserlayer (you can create them with paster localcommand
addcontent browserlayer
):- Add an interface for the layer.
- Create a browserlayer.xml file GenericSetup to register it as a layer.
Use the layer in viewlet registration:
- Edit your viewlet registration in configure.zcml with a layer attribute pointing to your interface.
In the configure.zcml linked file you can also see how to show the viewlet just for some content types (for
property) and just for default view of that content type (view
property).
Any other case, I think you should decide when to show/hide your viewlet code or template, like in the available method.
精彩评论