Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.

  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

5. jQuery and UI Libraries for XOOPS Themes > Link Your Theme to jQuery

The first method that comes to your mind should be adding:

<script src=" https://ajax.googleapis.com/ajax/libs/jQuery/1.6/jQuery.min.js"
    type="text/javascript"></script>

to the <head> section of theme.html.

This is very intuitive, and will work without too many disturbances. But you may ask: What disturbances might we encounter?

Look back at A Simple Example in Chapter 2, where I first introduced a bare bones theme. You might notice that there is a <{$xoops_module_header}> in the <head> section. This tells XOOPS to load the header required by specific modules—which allows a module to load what it needs on demand, instead of loading the files for the whole of XOOPS.

A common example is an editor’s JavaScript and stylesheet. As jQuery is very popular, many modules will load jQuery on demand. However, if you use the above code to load jQuery in your theme, it will be loaded again for some modules, thus causing some malfunctions (such errors will only happen in modules that load jQuery on demand, but not for the whole of XOOPS).


  

You are currently reading a PREVIEW of this book.

                                                                                                                    

Get instant access to over $1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint