adding certain CSS files to only certain pages of a Drupal project, rather than every page. This is commonly desired when you are using a drastically different front page in comparison to your drill pages. To achieve this you will want to use the drupal_add_css() function provided by the Drupal API.
it’s very basic in functionality: drupal_add_css(path_to_theme() . '/layout-fixed.css', 'theme', 'all'); Given a path to a CSS file, it will load it where ever the function is called. The second param specifies whether you are theming a “theme” or a “module” with it, and the third param reffers to the “media” attribute of the tag
To remove an existing CSS file per page, try something like:
$arrCSS = drupal_add_css();
unset($arrCSS['all']['theme']['path/to/css-file.css']);
$vars['styles'] = drupal_get_css($css);
return $vars;
it’s very basic in functionality: drupal_add_css(path_to_theme() . '/layout-fixed.css', 'theme', 'all'); Given a path to a CSS file, it will load it where ever the function is called. The second param specifies whether you are theming a “theme” or a “module” with it, and the third param reffers to the “media” attribute of the tag
To remove an existing CSS file per page, try something like:
$arrCSS = drupal_add_css();
unset($arrCSS['all']['theme']['path/to/css-file.css']);
$vars['styles'] = drupal_get_css($css);
return $vars;
No comments:
Post a Comment