The ie.css file included in the zen folder actually made a few things worse for me when viewing my site in ie, so I'd like to use my own.

I added the following to mytheme/template.php

drupal_add_css(path_to_subtheme() .'/ie.css', 'theme', 'all');

However, my theme is still calling the one in the zen folder as well as my version:

  <!--[if IE]>
    <link rel="stylesheet" href="/sites/whirligig.dreamhosters.com/themes/zen/ie.css" type="text/css">
          <link rel="stylesheet" href="/sites/whirligig.dreamhosters.com/themes/zen/whirligig/ie.css" type="text/css">
      <![endif]-->

What do I need to do to prevent it from calling the one in the zen folder?

Comments

AaronCollier’s picture

Do you have a custom page.tpl.php? If not, you should create one and change the following lines of code:

<?php if (file_exists($directory .'/ie.css')): ?>
      <link rel="stylesheet" href="<?php print $base_path . $directory; ?>/ie.css" type="text/css">
    <?php endif; ?>

Add in the path to your own ie.css or delete the call for the zen one. That should work.

johnalbin’s picture

Status: Active » Fixed

Aaron's solution appears correct. Thanks, Aaron!

kriskd’s picture

I think I may have spoke too soon. This is what I have in my page.tpl.php

  <!--[if IE]>
    <link rel="stylesheet" href="<?php print $base_path . $directory; ?>/ie.css" type="text/css">
    <?php if ($subtheme_directory && file_exists($subtheme_directory .'/ie.css')): ?>
      <link rel="stylesheet" href="<?php print $base_path . $subtheme_directory; ?>/ie.css" type="text/css">
    <?php endif; ?>
  <![endif]-->

And here's the source code generated:

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

So, with that, my ie.css will over ride the one in the zen folder, right?

AaronCollier’s picture

That way you'll have two ie.css files called. A better way might be something like this:

  <!--[if IE]>
    <?php if ($subtheme_directory && file_exists($subtheme_directory .'/ie.css')): ?>
      <link rel="stylesheet" href="<?php print $base_path . $subtheme_directory; ?>/ie.css" type="text/css">
    <?php else: ?>
      <link rel="stylesheet" href="<?php print $base_path . $directory; ?>/ie.css" type="text/css">
    <?php endif; ?>
  <![endif]-->
Anonymous’s picture

Status: Fixed » Closed (fixed)

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

andrenoronha’s picture

I'd like to know that, but I use a subtheme of zen in drupal 6.6
and I haven't got these lines in my page.tpl.php
I have only this:

print $styles;

where is this variable generated?

AaronCollier’s picture

You can look at the generic page.tpl.php that should come in the main Zen folder.

andrenoronha’s picture

thank you for your answear, but I found it on the zen.info file...

sobi3ch’s picture

That's right, you can find it in your .info file, around line 41


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