[Product-Developers] Best approach to conditional JavaScript includes

Kevin Gill kevin at movieextras.ie
Sat Jan 22 18:14:54 UTC 2011


Sorry, that should be...

           expression="here/view/test_js_require:is_js_required"

On 22/01/11 13:14, Kevin Gill wrote:
> I have a map widget that requires javascript includes. It is written 
> for dexterity / z3c.forms.
>
> What is the best / current approach to handling the conditional includes.
>
> If I put it into portal_javascripts it is managed by plone. However, I 
> have to work out whether to include it using tal. How will I compose 
> the tal statement to include the view - the examples I have seen work 
> on the context object. I assume I should have something like
>
> <?xml version="1.0"?>
> <object  name="portal_javascripts">
> <javascript
>         id="++resource++plonetheme.xxx.scripts/cufon-yui.js"
>         cacheable="True"  compression="safe"  cookable="True"
>         enabled="True"  inline="False"  insert-after="toc.js"
>
>         expression="view/test_js_require:is_js_required"
> />
> </object>
>
> Where test_js_require is a path adapter for my view.
>
> Any suggestions?
>
> Thanks
>
> Kevin
>
>
> _______________________________________________
> Product-Developers mailing list
> Product-Developers at lists.plone.org
> https://lists.plone.org/mailman/listinfo/product-developers




More information about the Product-Developers mailing list