Joomla菜单项类型iframe-wrapper无法加载javascript [英] Joomla menu item type iframe-wrapper doesn't load javascript

查看:134
本文介绍了Joomla菜单项类型iframe-wrapper无法加载javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为现有站点从头开始构建一个新模板,该模板使用菜单项类型iframe-wrapper来显示外部内容.

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.

我的模板使用了一些jQuery,除了在使用iframe-wrapper的那些页面上,它在到目前为止我检查过的所有页面上都可以正常工作.在这些页面上,joomla似乎没有包含它通常包含的任何js(jQuery,mootools,joomla东西).由于我需要jQuery,因此我的脚本会中断.

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.

我可能可以通过将jQuery硬编码到模板中来解决此问题.即使忽略所有可能导致它的问题,也只能解决我的部分问题.我使用一个模块包括一些内联js来初始化倒计时,以便可以从后端配置结束日期.该脚本也不包括在内,实际上整个模块在前端(或至少在其容器中)都丢失了.

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).

关于joomla,我是一个新手,所以这可能是我的一个明显错误,但是如何让joomla包含不显示iframe包装器时通常执行的js?

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?

推荐答案

让它终于可以工作:

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

添加到模板中的这一行可确保包含Joomla附带的jQuery版本,并且仅加载一次.

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

我仍然不知道为什么 jQuery只缺少一种特定的页面类型,而不是全部或全部,但是现在可以使用了.

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.

这篇关于Joomla菜单项类型iframe-wrapper无法加载javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆