开发者

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:

  1. 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.
  2. 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜