Hello,
I've got some additional Javascript I'd like to run on my site. Right now I've put it inside my custom theme directory, i.e:
sites/all/themes/mytheme/scripts/myscript.js
and in my theme template.php I call:
drupal_add_js(drupal_get_path('theme','deco') . "/scripts/myscript.js");
This all works fine, but I'd like to put the scripts somewhere where I can use them for multiple themes. Is there some "drupal wide" way of adding scripts, that doesn't depend on the theme?
If not, then I suppose I could put the scripts in theme root, i.e: sites/all/themes/scripts and call:
drupal_add_js(drupal_get_path('theme','deco') . "../scripts/myscript.js");
within each of my theme's template.php. ... it just doesn't *feel* right :)
Comments
You dont need to
put the js files in a theme subdir.
Why not sites/all/scripts ?
-----------------------------------------
Joep
CompuBase, Drupal websites and design
I suppose so. So then for
I suppose so. So then for each theme I'd have to edit the template.php to say:
drupal_add_js(drupal_get_path('theme','mytheme') . "../../scripts/myscript.js");
?? I suppose that is my real question... how to get the scripts "inside" of drupal. The only way I know how to at the moment is using "drupal_add_js" inside the theme, as described above.
Again: Why not in the
Again: Why not in the directory sites/all/scripts ?
You can include the js file in your page.tpl.php rather then calling drupal_add_js.
-----------------------------------------
Joep
CompuBase, Drupal websites and design
Thanks, that seems to work
Thanks, that seems to work best.