Joomla menu item type iframe-wrapper doesn't l

2019-08-30 13:38发布

问题:

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?

回答1:

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.



回答2:

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.