Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

A module I am using on my site uses the drupal_add_js() function to include some JavaScript. Although the function is used correctly the JavaScript file is included before the jQuery script which causes an error.

drupal_add_js(drupal_get_path('module', 'rate') . '/rate.js', array('scope' => 'footer', 'group' => JS_THEME)); 

Even if I add the weight option ('weight' => 500) it keeps be added before the jQuery script.

What am I supposed to do?

I am using newest Drupal 7, Rate API, and Rate widget.

share|improve this question
    
Try the same but skip the scope => footer part. –  Topsitemakers Nov 5 '12 at 19:48
    
That work's, but why? Should I report that as a bug for the module? But now there is another strange thing happening: The JavaScript is added at the right position but it depends on a value passed from PHP with:` drupal_add_js(array( 'rate' => array( 'basePath' => url('rate/vote/js'), 'destination' => $dest['destination'], ) ), array('type' => 'setting'));` This does not work either although it looks right to me. –  user5950 Nov 6 '12 at 0:08
    
Give some more details about your installation - where is $scripts variable located in your html.tpl.php template? –  Topsitemakers Nov 6 '12 at 7:46
    
Both, the drupal_add_js() that adds the file an the drupal_add_js() that adds a setting variable are located in the file rate.module of the rate module. I can't find anything wrong in the implementation, but it does not work, as described above. Thank you for your attention! –  user5950 Nov 6 '12 at 17:15
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.