tags:

views:

55

answers:

3

I notice that jQuery 1.2.6 is installed with the latest version of Drupal 6. But it's not called by content pages by default. Assuming I wanted to include a very simple jQuery code snippet (not a plugin, etc.) in a page:

I'm looking for a solution for non-coders. And while modifying php files is an option, it's my least desirable solution. Instead, I want to add in a script tag, pulling in the latest version?

I can imagine that it could cause problems we can't even anticipate down the road, but I've confirmed that it does work quite nicely on a single page (as of the current version, etc).

Is there another simple way to enable jQuery by default, something that can be done with minimal coding?

A: 

Looks like I can direct them to modify the .info file in a particular theme to include jQuery.

lynn
A: 

Check in your page.tpl.php of your theme this code:

    <?php print $scripts ?>
Nikit
+3  A: 

Yep, including it in your .info file should work fine.

A cautionary note for future reference, however: If you eventually find you need a newer version of jQuery than Drupal core provides, don't just upload that newer version to your theme folder and stick a reference to it in your .info file. You'll find Drupal adds its old version of jQuery on pages where it thinks jQuery is needed, and you'll end up with two versions of jQuery on one page. Instead, install the jQuery Update module, and put a reference to the new jQuery file it provides into your theme's .info.

Also, for those who don't mind coding, a call to drupal_add_js() in a hook_init() or a preprocess_page function will get Drupal to add jQuery to the page.

ksenzee