What is the correct way to make a ie8.css for a subtheme, and keep intact in the same time the original ie8.css of the base theme?

Hi to everybody, I've created a Topic in the Forum (since I think this could be a general question related to Theming) but so far seems like that nobody is answering, so I am trying to ask here too.

Hope someone can help, Thx all for the attention.

Francesco

Comments

mermentau’s picture

A sub-theme would be the way to go. Did you see the page for a sub-theme with MAYO?

francescosciamanna’s picture

Hi mermentau, Thx a lot for replying!

yes, I have read carefully the sub-theme with MAYO, but I did not find the solution for my problem (I paste here entirely what I wrote in the main Theming forum):

  1. I put a modified ie8.css file into the subtheme directory, and declared it into subtheme.info
  2. But it is simply ignored during the page render, as the matter of fact in the source page, the subtheme/css/style.css, subtheme/css/color.css, subtheme/css/subtheme.css are correctly appended but no trace of subtheme/css/ie8.css was found
  3. If I modify the base theme's ie8.css, the change is correctly inherited to the subtheme, but it also (naturally) affect the base theme itself.
  4. My problem is, I am dealing with a multilanguage site, and need some specific fix for Internet Explorer 8 only in one language(using subtheme),
  5. and keep as it in base theme for another language(using base theme).
mermentau’s picture

Putting it in subtheme.info is probably not needed as that is for all cases and you only want it loaded for IE8 users.

You could try creating a template.php and adding

/**
* Implements hook_preprocess_html().
*/

to it. That's where the conditional ie8.css is added.

Get the code from the Mayo base theme and change the function name to reflect the sub-theme name.

Also I don't think your issue is really special to MAYO. You might try http://drupal.stackexchange.com/ instead of the forum. I think that's where the support focus seems to be now.

francescosciamanna’s picture

Thank you mementau, my problem is solved!
Following is the code I put in the template.php:

<?php
  // Add conditional stylesheet for IE
  drupal_add_css(path_to_theme() . '/css/ie8.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'IE 8', '!IE' => FALSE), 'preprocess' => FALSE));
  drupal_add_css(path_to_theme() . '/css/ie.css', array('group' => CSS_THEME, 'browsers' => array('IE' => ' IE 7', '!IE' => FALSE), 'preprocess' => FALSE));
  drupal_add_css(path_to_theme() . '/css/ie6.css', array('group' => CSS_THEME, 'browsers' => array('IE' => 'IE 6', '!IE' => FALSE), 'preprocess' => FALSE));

  $options = array(
    'type' => 'file',
    'group' => CSS_THEME,
    'weight' => 10,
  );
mermentau’s picture

Status: Active » Closed (fixed)

You're welcome. Glad it worked for you.