I'm trying to get my own ie.css used instead of the one in the zen folder.

In mysubtheme.info there's this line:

 ; Set the conditional stylesheets that are processed by IE.
conditional-stylesheets[if IE][all][] = ie.css

I've done nealy everything I can think of to this line and can't get any other output except:

<!--[if IE]>
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/themes/zen/zen/ie.css?W" />
<![endif]-->

I want to change this output to:

<!--[if IE]>
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/themes/mysubtheme/css/ie.css?W" />
<![endif]-->

Anyone know how without altering the original zen files.

Comments

johnalbin’s picture

Status: Active » Fixed

In order to override a stylesheet from a module or a base theme, the path to the file (relative to your sub-theme's root) has to match the path to the file in the base theme or module. That's how Drupal core stylesheet overriding works.

So, since Zen has its ie.css in its root directory, you would have to have your ie.css in your sub-theme's root directory (and not in a "css" directory).

However, you can also remove stylesheets from a base theme or module, by specifying it in your .info file, but not including the file in your sub-theme.

So… you can remove Zen's ie.css and then add your css/ie.css like this (in your sub-theme's .info file):

; Remove Zen's ie.css file.
conditional-stylesheets[if IE][all][] = ie.css
; Add the ie.css file from the sub-theme's css directory.
conditional-stylesheets[if IE][all][] = css/ie.css

xstevex’s picture

Status: Fixed » Postponed (maintainer needs more info)

Thanks for your answer. I tested this here is what my .info file looks like:

 ; http://drupal.org/node/171209 for more details.
stylesheets[all][]  = css/layout.css
stylesheets[all][]  = html-elements.css
stylesheets[all][]  = css/html-elements.css
stylesheets[all][]  = tabs.css
stylesheets[all][]  = css/sydney.css
stylesheets[all][]  = messages.css
stylesheets[all][]  = css/messages.css
stylesheets[all][]  = block-editing.css
stylesheets[all][]  = css/block-editing.css
stylesheets[all][]  = wireframes.css
stylesheets[all][]  = css/wireframes.css
stylesheets[print][] = print.css
stylesheets[print][] = css/print.css
stylesheets[all][] = css/system.css
stylesheets[all][] = css/defaults.css
stylesheets[all][] = css/user.css
stylesheets[all][] = css/system-menus.css
stylesheets[all][] = css/admin.css
stylesheets[all][] = css/node.css
stylesheets[all][] = zen.css
conditional-stylesheets[if IE][all][] = ie.css
conditional-stylesheets[if IE][all][] = css/ie.css

But here is my output:

<link rel="shortcut icon" href="/sites/all/themes/sydney/favicon.ico" type="image/x-icon" />
  <link type="text/css" rel="stylesheet" media="all" href="/sites/all/modules/cck/theme/content-module.css?o" />
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/modules/fckeditor/fckeditor.css?o" />
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/modules/filefield/filefield.css?o" />
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/modules/imagefield/imagefield.css?o" />
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/modules/lightbox2/css/lightbox.css?o" />
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/themes/sydney/css/layout.css?o" />
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/themes/sydney/css/html-elements.css?o" />
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/themes/sydney/css/sydney.css?o" />
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/themes/sydney/css/messages.css?o" />
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/themes/sydney/css/block-editing.css?o" />
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/themes/sydney/css/wireframes.css?o" />
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/themes/sydney/css/system.css?o" />
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/themes/sydney/css/defaults.css?o" />
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/themes/sydney/css/user.css?o" />
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/themes/sydney/css/system-menus.css?o" />
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/themes/sydney/css/admin.css?o" />
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/themes/sydney/css/node.css?o" />
<link type="text/css" rel="stylesheet" media="print" href="/sites/all/themes/sydney/css/print.css?o" />
<!--[if IE]>
<link type="text/css" rel="stylesheet" media="all" href="/sites/all/themes/zen/zen/ie.css?W" />
<![endif]-->
  <script type="text/javascript" src="/misc/jquery.js?o"></script>

I did clear the cache and the ie.css is actually in the folder. It seems to work for all stylesheets except for the conditional ones.

chris7148’s picture

Version: 6.x-1.x-dev » 6.x-1.0-beta3
Component: IE Problems » Code
Status: Postponed (maintainer needs more info) » Active

Hi xstevex, did you manage to solve this problem? I have a similar issue - none of my subtheme's conditional stylesheet declarations are being included - only those declared in the original Zen theme (I'm using beta 3).
Thanks,
Chris

AaronCollier’s picture

Does this issue help at all? #254502: Use my own ie.css

johnalbin’s picture

Status: Active » Postponed (maintainer needs more info)

I just learned that "clearing the cache" doesn't affect Drupal's storage of the .info file contents. You need to visit admin/build/themes in order for Drupal to re-build that information. Does that fix your problem?

financialgeek’s picture

I'm having the same issue of my ie.css not being included from the subtheme folder. This is a change from beta2, which subtheme/ie.css was included just fine. I noticed that the beta2 .info file did NOT have the conditional line, these two lines were added in beta3:

  ; Set the conditional stylesheets that are processed by IE.
conditional-stylesheets[if IE][all][] = ie.css

So somethings changed from beta2 to beta3.

marcor’s picture

Same issue here. What further information is needed by the maintainer? Please tell us what is needed, Zen is too cool to lack this. :-)

mndonx’s picture

IE stops loading stylesheets after 20 (I think that's the limit). If you have more than that, you need to optimize your css, under Settings -> Performance. That has tripped me up before.

mndonx’s picture

Component: Code » IE Problems

Actually, I was wrong: the IE stylesheet limit is 30. BUT I ran into this problem today, and after some time away from the computer, I looked at my admin/build/themes pages and realized that my subtheme was unchecked -- although selected as default. Not sure how that could have happened, but rechecking it solved my problem.

Hope that might help someone!

johnalbin’s picture

Component: IE Problems » PHP Code

Amanda, I'm glad your issue is fixed. But I don't think it is related to this issue, since the problem here is that the wrong file is being linked to in the HTML.

Marco, the additional info I need is for someone to test all possible fixes that I mentioned above. And then to report back with their results.

  1. Make sure your subtheme.info has the code mentioned in #6 above.
  2. Go to admin/build/themes (as I said in #5 above) so that Drupal refreshes its cache of your sub-theme's .info file.
  3. report back

I am having no issues in getting an ie.css in my sub-theme. So I need more info from those of you who are having issues.

web360’s picture

To override the default ie.css provided by the Zen "super" theme:

  1. Override Zen's ie.css:

    conditional-stylesheets[if IE][all][] = ie.css
    
  2. Insert your own:

    conditional-stylesheets[if lt IE 7][all][] = css/ie6.css
    

Note: The new CSS file must exist on your subtheme directory. In my example, the CSS file is found inside a folder named css.

stella’s picture

I had the same problem, but visiting admin/build/themes fixed it. Thanks @JohnAlbin!

SimonEast’s picture

I still cannot get this working... I have an "ie.css" file in my subtheme directory.
........

[EDIT]
OK, after 2 hours or more of frustration trying to get this to work, I finally realised that the stylesheets[] array gets refreshed when you just visit /admin/build/themes, however the conditional-stylesheets[] array only gets refreshed once you SUBMIT the form on /admin/build/themes, or you otherwise clear your cache under /admin/settings/performance.

Hope that helps somebody else out there!!

Simon.

bropp’s picture

Thank you! That saved me atleast another hour of frustration.

abbbu’s picture

Thanks a lot SimonEast!!! You saved me lot of frustration....

AaronCollier’s picture

Status: Postponed (maintainer needs more info) » Fixed

It seems fixed now.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

dealancer’s picture

Title: own ie conditional stylesheet in subtheme » Try to use Conditional-CSS Integration

You also could use Conditional-CSS Integration module, which allows you to use css in a way like this:

/* Conditional-CSS example */  
a.button_active, a.button_unactive {  
  display: inline-block;  
  [if lte Gecko 1.8] display: -moz-inline-stack;  
  [if lte Konq 3.1] float: left;  
  height: 30px;  
  [if IE 5.0] margin-top: -1px;  
    
  text-decoration: none;  
  outline: none;  
  [if IE] text-decoration: expression(hideFocus='true');  
}  
dealancer’s picture

Title: Try to use Conditional-CSS Integration » own ie conditional stylesheet in subtheme

changing title back

apprayo’s picture

Component: PHP Code » layout.css

#13 => thanks a lot Simon!