简体   繁体   English

Joomla模块文件结构来存储jquery核心和一些图像文件

[英]Joomla modules file structure to store jquery core and some image files

I'm a newbie to joomla. 我是joomla的新手。 I'm trying to create a joomla module which uses some jquery actions and some image files. 我正在尝试创建一个使用一些jquery动作和一些图像文件的joomla模块。

Can anyone suggest me a best method to place the jquery-core and jquery plugin files inside the module. 谁能建议我将jquery-core和jquery插件文件放在模块内的最佳方法。 I also wants to add some image files with my module. 我还想在模块中添加一些图像文件。

To include the JQuery you should use $document->addscript() 要包含JQuery,您应该使用$ document-> addscript()

http://docs.joomla.org/Adding_JavaScript http://docs.joomla.org/Adding_JavaScript

You should be aware that it might conflict with Mootools already loaded so you might need to use the noconflict flag for jquery to get it to work. 您应该意识到它可能与已经加载的Mootools冲突,因此您可能需要对jquery使用noconflict标志才能使其正常工作。

I might be not the best person for Joomla, but can't you just get your script in mod_[modulename].php file? 我可能不是Joomla的最佳人选,但您不能只将脚本保存在mod_ [modulename] .php文件中吗? Or I might now have understood your question. 或者我现在可能已经理解了您的问题。

It is better if you use the manual script tag ( <script></script> ) to include your jQuery to avoid it conflicting with any other included scripts. 最好使用手动脚本标记( <script></script> )包含jQuery,以避免它与任何其他包含的脚本冲突。

$doc->addScript will add the script to the head tag while manual inclusion will just place just above your module, which is much safer. $doc->addScript会将脚本添加到head标记,而手动包含将恰好放置在模块上方,这更加安全。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM