tags:

views:

29

answers:

3

Hello i have two pages: page 1 and page 2.

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

How to do this in drupal?

A: 

Hi, Please try using drupal_add_js and drupal_add_css

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 be the master of everything ;)

Hope this helps,

Ramon Araujo
+1  A: 

You can do this from a 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

Kevin
A: 

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

zerolab

related questions