Tuesday, 26 May 2009

HOWTO: Add css for IE within zen-cart

1) Prepare a css file for IE, called ie7.css, located in /includes/templates/template_default/my

2) Add the following codes:
echo '<!--[if lte IE 7]><link rel="stylesheet" href="' . $template->get_template_dir('.css',DIR_WS_TEMPLATE, $current_page_base,'my') . '/ie7.css" />'."\n".'<![endif]-->';

around the following codes in /includes/templates/template_default/common/html_header.php

 * load all template-specific stylesheets, named like "style*.css", alphabetically


  $directory_array = $template->get_template_part($template->get_template_dir('.css',DIR_WS_TEMPLATE, $current_page_base,'css'), '/^style/', '.css');

  while(list ($key, $value) = each($directory_array)) {

    echo '<link rel="stylesheet" type="text/css" href="' . $template->get_template_dir('.css',DIR_WS_TEMPLATE, $current_page_base,'css') . '/' . $value . '" />'."\n";


1 comment:

Chris said...

Thank you for this blog post. I used it and it works! Very helpful indeed! Other readers might like to know, "my" is a folder that needs be created.

Thanks again!

My photo
London, United Kingdom

Facebook & Twitter