I successfully managed to override Drupal CSS using this method (Overriding drupal.css; two approaches).
Now how do I override more stylesheets at the same time, for example module-stylesheets?

Comments

fletcherson’s picture

To the code below how do I add more CSS'files?

 print str_replace('<st yle type="text/css" media="all">@import "misc/drupal.css";</style>', '', $head); 

I tried doing the following gave me "argument count errors", but I can't spot where I did a mistake (I didn't forget to remove the space in st yle):

<?php
print str_replace('<st yle type="text/css" media="all">@import "misc/drupal.css";</style>', '', $head);
print str_replace('<st yle type="text/css" media="all">@import "modules/video/video.css";</style>', '');
print str_replace('<st yle type="text/css" media="all">@import "modules/image/image.css";</style>', '');
?>

I also tried duplicating, adding more functions or adding more to the existing function, however I I couldn't think of a name I could give the 2nd function, because it looks like the function has a specific/special name. Maybe I'd need to add elseif? How can I do this?

function phptemplate_stylesheet_import($path, $media = 'all') {
  if ($path != base_path() .'misc/drupal.css') {
    return '<style type="text/css" media="'. $media .'">@import "'. $path .'";</style>';
  }
}

I tried doing the following but it doesn't work for some or another reason (I might have to ad an else in the end that simply tells it to do nothing):

function phptemplate_stylesheet_import($path, $media = 'all') {
  if ($path != base_path() .'misc/drupal.css') {
    return '<style type="text/css" media="'. $media .'">@import "'. $path .'";</style>';
  }
  elseif ($path != base_path() .'modules/image/image.css') {
    return '<style type="text/css" media="'. $media .'">@import "'. $path .'";</style>';
  }
  elseif ($path != base_path() .'modules/image_gallery/image_gallery.css') {
    return '<style type="text/css" media="'. $media .'">@import "'. $path .'";</style>';
  }
}