Uploading a specific js and css file to a specific page in drupal

page 1 and page 2.

Now for page 1 I want to download page1.js and page1.css and for page2 I want to download page2.css and page2.js.

How to do it in drupal?

+4
source share
3 answers

You can do this from the module:

function mymodule_init() { if (request_uri() == 'path') { drupal_add_js( // arguments ); drupal_add_css( // arguments ); } } 

http://api.drupal.org/api/function/drupal_add_js

http://api.drupal.org/api/function/drupal_add_css

+2
source

Try using drupal_add_js and drupal_add_css

Please note that you can use php tags inside your page, there you can call drupal functions and so on. Otherwise, you can create your own Drupal module and become the master of everything;)

Hope this helps,

+1
source

If you are not too comfortable diving into the code, you can try using http://drupal.org/project/css_injector and http://drupal.org/project/js_injector , although the answers of Kevin and Ramon Araujo are more common :)

0
source

All Articles