Add Javascript to a theme
2 posters
Page 1 of 1
Add Javascript to a theme
Question.
I try to add javascript to a theme. I found out that the path 'images' can be found if put in a theme, and 'img' not.
Now, if I would like to add some Javascript from a folder 'js' in the themes-dir, how would I add this??
======================
Seo Marketing|Link Building
martin2020- Posts : 259
Join date : 2011-03-08
Re: Add Javascript to a theme
The PHP function drupal_add_js() lets you add a JavaScript file, setting or inline code to the page and it takes 5 parameters (see the api reference).
The first parameter is always going to be a path to a js file, an array, or a piece of JavaScript code. If the second parameter is 'module' (the default), 'theme', or 'core', then the first parameter must be a path and the only difference between these three is the order in which the script tag will be placed relative to other scripts, i.e. core scripts first, then module scripts and finally theme scripts.
The first parameter is always going to be a path to a js file, an array, or a piece of JavaScript code. If the second parameter is 'module' (the default), 'theme', or 'core', then the first parameter must be a path and the only difference between these three is the order in which the script tag will be placed relative to other scripts, i.e. core scripts first, then module scripts and finally theme scripts.
Page 1 of 1
Permissions in this forum:
You cannot reply to topics in this forum
|
|