Question

I am building a new template from the ground up for an existing site that uses the menu item type iframe-wrapper to display external content.

My template uses a bit of jQuery which works fine on all pages I have checked so far, except for those using the iframe-wrapper. On those pages joomla does not seem to include any of the js it usually does (jQuery, mootools, joomla stuff). Since I need jQuery my scripts break.

I could probably work around that by hardcoding jQuery into the template. Even ignoring all the problems that would most likely cause it solves only part of my problem. I use a module to include a bit of inline js to initialize a countdown so the end-date can be configured from the backend. That script is not included either, infact the whole module is missing in the frontend (or at least its container).

I am quite the novice with regards to joomla so this might be an obvious mistake on my end but how do I get joomla to include the js it usually does when not displaying an iframe-wrapper?

Was it helpful?

Solution

Got it to work finally:

JHtml::_('jquery.framework');

This line added to the template ensures that jQuery version shiped with Joomla is included and only loaded once.

I still don't know why jQuery was only missing from one specific pagetype rather than all of them or none, but it's working now.

OTHER TIPS

If the iFrame is not part of the Joomla website and not part of the Joomla environment (which is the case 99.99% of the times), you will need to re-add the JS files there manually. There's no other way for doing this.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top