Sunday, July 24, 2011

drupal_add_css is not working

Drupal remove css file starts with base path. For example, if you are trying to add  css like drupal_add_css(base_path().drupal_get_path('module','your_module').'css/mystyle.css'), then base_path() function is make your css file unreadable.

To fix this remove base_path() function from drupal_add_css and you should say drupal as follows drupal_add_css(drupal_get_path('module','your_module').'css/mystyle.css'). The css path string should look like /sites/all/modules/your_module/css/mystyle.css instead of /your_project /sites/all/modules/your_module/css/mystyle.css.

Drupal 7 provide more flexible options data will allow you to change path. For more detail go to

Note: Please leave your queries and suggestion as comment.

No comments:

Post a Comment