javascript 参考错误:未定义 Joomla

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/17463000/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-27 08:25:51  来源:igfitidea点击:

ReferenceError: Joomla is not defined

javascriptmootoolsjoomla2.5joomla-extensions

提问by Vinay Mehta

I am developing a joomla component. It is executing but giving

我正在开发一个 joomla 组件。它正在执行但给予

ReferenceError: Joomla is not defined

ReferenceError: Joomla is not defined

I check that default java scripts like motool.js core.jsare not loading.

我检查motool.js core.js没有加载默认的 java 脚本。

How can I load them automatically and not manually like <script src=""></script>?.

如何自动加载它们而不是手动加载<script src=""></script>?。

回答by Laoneo

JHTML::_('behavior.mootools');

should load mootools.

应该加载 mootools。

If core is not loaded then run

如果未加载核心,则运行

JHtml::_('script', 'system/core.js', false, true);

回答by vladkras

my problem was with public $live_sitevar in configuration.php. I didn't use http://prefix before it, so all links to scripts in admin panel looked like http://mycoolsite.com/administartor/mycoolsite.com/media/system/js/script.js

我的问题是public $live_site在 configuration.php 中的 var。我http://在它之前没有使用前缀,所以管理面板中所有脚本的链接看起来像http://mycoolsite.com/administartor/mycoolsite.com/media/system/js/script.js

That's why Joomla Object was not loading. Hope this will help someone.

这就是未加载 Joomla 对象的原因。希望这会帮助某人。

回答by Alagesan

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

it will clear your joomla javascript error

它将清除您的 joomla javascript 错误