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

查看:23
本文介绍了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 包装器的页面.在这些页面上,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天全站免登陆