By PED-1 on
My scripts don't seem to be loading?
<?php print $scripts ?> is in the page template header.
I've tried defining no scripts in the theme .info file - should I get a default set in this case (including jquery)?
I've also tried adding scripts[] = /misc/jquery.js into the theme .info file and still no scripts are getting rendered into the HTML.
Hopefully this is just a dumb error on my part and easily solved. Only 2 hrs sleep last night.
Thanks for any help in advance. P.
Comments
off the top of my head, make
off the top of my head, make sure your theme also prints the $closure variable right before the end of the markup. something like:
Yes, it has the closure
Yes, it has the closure line. Hmm?
PE Design
http://www.pedesign.co.uk
I'm having the same issue
I'm having the same issue and stumbled across this post. Were you able to resolve this and if so, how?
Hi seedough, yes eventually
Hi seedough, yes eventually resolved the issue by adding
drupal_add_js()lines to my theme's template.php file.e.g.
drupal_add_js(drupal_get_path('theme', 'yourthemename') .'/yourscript.js', 'theme');Once I'd added this all the scripts loaded into the head properly. Very strange as the explanation doesn't suggest that you need to do this to get the scripts to load.
If this doesn't work let me know - I'm pretty sure it was just this.
Sorry should have posted back here soon as I resolved it. :-/ Bad me.
PE Design
http://www.pedesign.co.uk
This worked for me.
I've never had to do this on other sites, but hey, it worked, and thanks.
Ran into the same problem
I ran into the same problem ... first of all, make sure you added your JS files to the theme.info
; Scripts to include
scripts[] = js/yourjsfile-1.js
scripts[] = js/yourjsfile-2.js
...
AFTERWARDS make sure you clear your Drupal Cache ... after I cleared my cache it worked without having to use the add_js function like mentioned above.
I had the same problem... It
I had the same problem... It took me several hours to figure this one out.
It seems Drupal won't load any javascript onto the page if it thinks it doesn't have to.
That is, if it's not aware on page load of any modules or theme .info files calling script into the page then it won't load its default script files ( jquery and drupal.js )
On a fresh drupal install, I tried running a jquery script on a page, and jquery was not loaded, because by default garland does not have any scripts in its .info file. I had not yet installed any modules that would call drupal_add_js either.
I added a blank script to the garland .info file, and cleared the site cache. Then, drupal loaded the blank script, along with jquery and drupal.js ( even though i didn't mention these 2 default scripts in the info file, or do anything to include them.... )
weirrrdd....
control characters in .info file
I had the same 'scripts not loading issue', and it turned out the .info file that was transferred (using sftp) to Linux from my windows workstation had carriage return ("Control M") control character in every line. The scripts (script1.js, script2.js) were both wrapped to the single line because of this.
scripts[] = script1.js ^M script2.js
On Linux, I then converted the .info file to unix format using the following command
dos2unix mytheme.info
After clearing cache in Drupal admin console for the site, problem went away.
Hope this will be helpful for those who may have the same issue.
Not that weird
@tmsimont: I had this issue today with a new D6 site build. I have everything working fine on my WAMP server but after an FTP transfer, DB dump and everything to do with migration to Linux, my jquery.js was not being included unless I was logged in as admin. Following the documentation, I found this:
I had specified this in my info file:
scripts[] = scripts.jsAnd at the root of my theme was an empty file called script.js. Spot the difference? Eventually I did, although this seems at odds with the documentation:
I like the D7 way best!