Search code examples
javascriptjoomlajoomla3.2

Joomla menu item type iframe-wrapper doesn't load javascript


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?


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.