开发者

How do I add a link to an external marketing video to the site home page?

I'开发者_运维技巧m not much of a programmer and I need some assistance in adding an external link to the home page of my site. It's a JavaScript hosted on a provider's site that will integrate a marketing video on my site (Plone 3.2).

I looked at the portal_javascripts registry, but I'm not clear on how to ensure the link is only run on the home page.


In JavaScript registry fill the condition field with this expression:

python:(folder.meta_type=='Plone Site') and (context.getId()==folder.getDefaultPage())

Where:

  • context is the current object.
  • folder is the container for current object. In case of objects in Plone site root, it is the site itself.
  • folder.meta_type is the portal type of the container.
  • folder.getDefaultPage() gets the container's default page. In case the container is the Plone site, it is the home page of your site.


In the javascript registry, use a "condition" (if you mean you're editing through the ZMI) or "expression" (if you're doing this in javascripts.xml via GenericSetup) of

python:context.portal_url() == context.absolute_url()

There are better ways - you should really be testing if the interface Products.CMFPlone.interfaces.siteroot.IPloneSiteRoot is provided_by context:

>>> from Products.CMFPlone.interfaces.siteroot import IPloneSiteRoot 
>>> IPloneSiteRoot.providedBy(context)
True

but I'm not sure how to do that in a portal_javascripts condition.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜