HOME TIPS FORUMS DOWNLOADS
   »»  Tips Archive |
Themes : jQuery and XOOPS
Posted by nachenko on 2007/10/31 18:23:20 (4674 reads)
Themes

jQuery is XOOPS compatible if you follow these tips.

You can use jQuery library in your XOOPS theme, as usual, but if you just follow jQuery's official documentation, you won't be able to run it properly in all browsers.

There's an incompatibility between jQuery and XOOPS own javascript code, but it can be overriden.



To do so, you need to follow these steps:

1- include it in a way that does not depend on the path by using <{$xoops_url}>, like this:

<pre><script src="<{$xoops_url}>/jquery/jquery.js"></script></pre>

2- Don't use the $ function to execute jQuery. XOOPS has it's own $ function, use the original "jQuery". Like this:

<pre>jQuery(document).ready();</pre>

3- Include jQuery files before this line in your theme:

<pre><{$xoops_module_header}></pre>

As this line will load includes/xoops.js, wich has it's own definition of the $ function.

Printer Friendly Page Send this Story to a Friend
The comments are owned by the poster. We aren't responsible for their content.
Poster Thread
wishcraft
Posted: 2008/5/22 10:40  Updated: 2008/5/22 10:41
Just popping in
Joined: 2008/5/22
From:
Posts: 1
 Re: jQuery and XOOPS
<pre><script src="<{$xoops_url}>/jquery/jquery.js"></script></pre> 


Is an incorrect call of smarty, you do not use the <{$xoops_url}> in smarty for JS and images there are xo functions for this unless they are essential items to call over this..

Why is this, well on various if not all SSL it is expandie cryptology and on heavy load site your pages will load real slow if all the content is over SLL

and example of this for XOOPS_ROOT_PATH/jquery/jquery.js it is:

<pre><script src="<{xoImgUrl /jquery/jquery.js}>"></script></pre>

## or XHTML

<pre><script src="<{xoImgUrl /jquery/jquery.js}>"/></pre>