I am working with the new RC1 for drupal 6 and in the .info file I have 3 scripts listed but they do not seem to make it into the rendered template html header.

so

script[] = script.js
script[] = script_foo.js
script[] = script_bar.js

with this in head of page.tpl.php

<?php print $scripts ?>

should place this in the head section with the

<script type="text/javascript" src="/yada/yada/script.js"></script>
<script type="text/javascript" src="/yada/yada/script_foo.js"></script>
<script type="text/javascript" src="/yada/yada/script_bar.js"></script>

Am I missing something here ?

Comments

sdgreene’s picture

Pretty sure the variable name is scripts[] (with an s).

zenrax’s picture

Thank you for the reply and yes, you are right, it is script(s). I just forgot that on this post but in the .info file it is scripts[]..

hmmm ..

I guess I will just add it to the head myself. The stylesheets[] work great though.

christian_gnoth’s picture

Hello,

I had the same problem and only after deactivating the caching mechanism in drupal the scripts were included.

knalstaaf’s picture

It finally worked out by adding the links one by one. Why did that work after all? I have absolutely no idea.

puya’s picture

What do you mean by one by one? should I add> Save , then Add>Save again? I am having the same problem..
thanks

torgospizza’s picture

Confirmed. There are two things to make sure of when you are adding script or CSS files into your .info file:

1) Make sure the file is there. Drupal will check; if it doesn't see the file (doesn't exist, permissions error, etc.) the file won't get added. It will only look for files from within the theme, it seems.
2) Clear the cache. Best way to do this is install Devel module and visit example.com/devel/cache/clear

Got it working consistently for me. Added files to the directory sites/all/themes/zensubtheme/js/... folders and had them showing up easily.

HTH.

Have I helped you? Consider buying me a beer.

puya’s picture

What do you mean when you say one by one? I have the same problem..

thanks