Kayak (SinK) Fishing
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Add Javascript to a theme

2 posters

Go down

Add Javascript to a theme Empty Add Javascript to a theme

Post  martin2020 Sun Apr 17, 2011 8:31 am


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

Back to top Go down

Add Javascript to a theme Empty Re: Add Javascript to a theme

Post  JamesRobert Mon Jul 18, 2011 12:57 am

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.

JamesRobert

Posts : 1
Join date : 2011-07-18

http://www.ceilingfansgalore.com/

Back to top Go down

Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum