Block javascript in template

Everyone knows that Requirements::block('/path/to/javascript.js'); in php blocks this file from being loaded. This is important to e.g. require a newer version of jQuery. But you can easily block javascript in your template.

The template code <% require %> can call any method in Requirements class, so this works fine:

<% require block(framework/thirdparty/jquery/jquery.js)%>
<% require javascript(themes/mytheme/javascript/thirdparty/jquery.min.js) %>

With this you won't need an extension for controller any more, that just blocks and requires some javascript.

Rate this post

Post your comment

Comments

No one has commented on this page yet.

RSS feed for comments on this page | RSS feed for all comments