I need to get an extra script on my site to work. I have followed the instructions for the theme.info method of adding scripts[] = js/scripts.js, cleared my site cache and browser cache. I still get no scripts. I have followed this thread - http://drupal.org/node/266585.
I am using the Omega theme, which calls for the js/omega.js file. It has no scripts.js file. I am trying to add a script that prompts IE6 and IE7 users to upgrade their browsers. The script is here - http://code.google.com/p/sevenup/ I know the script works, I tested it on a dev Joomla site and it fired the first time.
So how do I include multiple js files?
My current theme.info is like this-
scripts[] = js/omega.js
scripts[] = fix-ie/sevenup.0.3.js
scripts[] = fix-ie/sevenup_black.0.3.js
Any help is greatly appreciated!
Comments
relative paths
Is your "fix-ie" directory located in sites/all/themes/omega?
Yes it is.
Yes it is.
To get my scripts recognised,
To get my scripts recognised, I had to Clear cached data (Admin|Performance) first.
I had also tried to place my scripts in my /modules directory (they weren't part of the original script), but the only path I could find that worked on my multi-site set-up was:
All other path variants did not work, even though the path relative to the base_url should work eg:
I ended up creating a new /js directory in my theme, and added the following to my theme's .info file:
Alternative method
The method I used above would only allow the script to reside in the theme's directory. Since I use a multisite set-up, I wanted my scripts to appear in a common directory, such as
Adding scripts to Omega
In case you come across this looking for a solution to how to add Javascript files to Omega.
There are two main options:
If you want to add a javascript file to all of your pages (and you can optionalise this if you use delta - e.g. turn it off for certain deltas)
Then in your starter kit theme (your custom subtheme)
mytheme.info
add the following:
This is then available to toggle on and off in your settings configuration at "admin/appearance/settings/mytheme"
Your file then gets added alongside the other libraries such as media queries, formalize etc
If you would like to only add the file to certain pages then in your template.php
George Boobyer
www.blue-bag.com