(This thread is a continuation of http://www.zen-cart.com/forum/showthread.php?p=294562 and attempts to improve upon that glorious snippet of code.)

I'm posting a new thread on the topic of IE Conditional Comments because the best one I've found so far (cited above) was in the wrong category for my needs, and an exhaustive search of the forums failed to turn up anything brand new on the subject. Apologies if I've chosen the wrong category to post in. It's my first time here! :=)

I'm working on my first ever ZenCart install, version 1.3.7, and I am needing to serve a stylesheet to all browsers that are less that IE 7. I need this to control the horribly huge font size that IE 6 and below thinks is "medium". All other browsers can use "medium" as whatever the user has chosen for their preferred font size, but not IE. Hence the exploration of the insanely great module called Internet Explorer Stylesheet Overrides and how it might be able to do even more for us. Here's what I want:

Duncanad and Kuroi's module is simple. It calls stylesheets from your /includes/templates/CUSTOM_TEMPLATE_NAME/css/ folder, and it does so using a single snippet of php. You just paste this code into your /includes/templates/CUSTOM_TEMPLATE_NAME/common/html_header.php file right below the section that calls all the regular stylesheets. (The comment says "load all template-specific stylesheets, named like "style*.css", alphabetically")
PHP Code:
/**
 * IE Conditional Comments
 * Load all template-specific stylesheets for IE in alphabetical order, but AFTER 
 * the main stylesheets have been called, thus overriding them in the cascade.
 * Naming convention for stylesheet files is as follows:
 * "ie_stylesheet.css" targets all versions of IE
 * "ie7_stylesheet.css" only targets IE 7
 * "ie6_stylesheet.css" will only affect IE 6
 * "ie5.5_stylesheet.css" will only affect IE 5.5
 */
  
$directory_array $template->get_template_part($template->get_template_dir('.css',DIR_WS_TEMPLATE$current_page_base,'css'), '/^ie[5-9]_/''.css');
  while(list (
$key$value) = each($directory_array)) {
    
$ver substr ($value21);
    echo 
'<!--[if IE ' $ver ']>' "\n";
    echo 
'<link rel="stylesheet" type="text/css" href="' $template->get_template_dir('.css',DIR_WS_TEMPLATE$current_page_base,'css') . '/' $value '" />' "\n";
    echo 
'<![endif]-->' "\n";
  } 
As you can see, this module will load a stylesheet for all versions of Internet Explorer [if IE], or a separate stylesheet that just targets a flaw in IE5.5 [if IE 5.5]. But the module is lacking something. Conditional Comments also allow you to load a stylesheet for all versions of the browser that are less than a certain version. [if lt IE 7] means "all versions less-than IE 7". Version 7 doesn't suffer from the huge text flaw when "medium" is left up to the user's choice of font size. Hence the need for me to be able to serve a stylesheet to all version of IE that are less-than-IE7 a file that ratchets their default font sizes down by a click. body {font-size:small} and so forth.

I plan on hacking away at the above snippet of code until it does what I want it to. When I get it, I'll post again right here, and hopefully one of the Zen Masters will re-roll the module?