tags:

views:

266

answers:

1

For some reason one of my Drupal installations doesn't include jquery.js automatically. The most strage thing is that on local hosting all themes include jquery, but on remote hosting the theme I am using - wabi - for some reason doesn't include jquery, and as I see, $scripts variable in page.tpl.php is empty. My initial expectation was this code to appear automatically :

  <script type="text/javascript" src="/misc/jquery.js?q"></script>

How can I find out the reason why jquery is not included? Is it some settings?

+1  A: 

It only appears on pages for which it's needed. Using the function drupal_add_js in the theme or module triggers jQuery's inclusion. If you're not using drupal_add_js to add your scripts, Drupal doesn't know that you need jQuery included.

ceejayoz
That didn't work either. My temporary solution is to hard code script inclusion into page.tpl.php
PHP thinker
Can we see the module code in which you're using `drupal_add_js`? The behaviour you're describing should not be possible.
ceejayoz
I was trying to add this code into template.php of my theme file.
PHP thinker
Are you specifying the full path to the JS file? Have you tried doing it in the .info file instead (http://drupal.org/node/171205#scripts)?
ceejayoz
I tried function phptemplate_preprocess_page(....and scripts[] = http://drupal-builder.net/misc/jquery.js in info file, still no result, I will try to clean cache
PHP thinker
There's your problem. **1.** Can't use URLs like that. Should be 'path/to/script.js' (like `sites/all/modules/mymodule/mymodule.js`) in `drupal_add_js`. If specifying in the theme's `.info` file, the JS file you're including should be in the theme directory and referenced locally. **2.** No need to include jQuery at all. Include your own JS code via `drupal_add_js` with a proper path or via the .info file and jQuery will be automatically included.
ceejayoz