4

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?

3 Answers 3

2

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

Sign up to request clarification or add additional context in comments.

Comments

1

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,

Comments

0

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 :)

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.