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

╄→гoц情女王★ 提交于 2019-12-11 19:08:06

问题


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.



来源:https://stackoverflow.com/questions/21580724/joomla-menu-item-type-iframe-wrapper-doesnt-load-javascript

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!