scitrenbaum,
Here is how to do what you want to do:
Firstly there is a minor flaw in my original solution which requires to be corrected before we can proceed.
The only file that you need to modify is:
includes/templates/your_template/common/html_header.php
at about line 54 you will find:
Code:
$directory_array = $template->get_template_part($template->get_template_dir('.css',DIR_WS_TEMPLATE, $current_page_base,'css'), '/^ie_/', '.css');
replace this with:
Code:
$directory_array = $template->get_template_part($template->get_template_dir('.css',DIR_WS_TEMPLATE, $current_page_base,'css'), '/^ie_style/', '.css');
and at about line 64 find:
Code:
$directory_array = $template->get_template_part($template->get_template_dir('.css',DIR_WS_TEMPLATE, $current_page_base,'css'), '/^ie[5-9]_/', '.css');
replace this with
Code:
$directory_array = $template->get_template_part($template->get_template_dir('.css',DIR_WS_TEMPLATE, $current_page_base,'css'), '/^ie[5-9]_style/', '.css');
The problem with my original solution is that any stylesheet prefixed by 'ie_' or 'ie?_' (where ? is the version number) will be loaded for every page which isn't exactly what it says on the tin and will mess things up when we apply the additional functionality to target IE specific stylesheets to specific pages. The above amendments mean that stylesheets prefixed 'ie_style' or 'ie?_style' will be loaded for every page, which was the original intention anyway.
Now for the IE targeted per-page stylesheets. At about line 71 find:
Code:
/**
* load stylesheets on a per-page/per-language/per-product/per-manufacturer/per-category basis. Concept by Juxi Zoza.
*/
$manufacturers_id = (isset($_GET['manufacturers_id'])) ? $_GET['manufacturers_id'] : '';
$tmp_products_id = (isset($_GET['products_id'])) ? (int)$_GET['products_id'] : '';
$tmp_pagename = ($this_is_home_page) ? 'index_home' : $current_page_base;
$sheets_array = array('/' . $_SESSION['language'] . '_stylesheet',
'/' . $tmp_pagename,
'/' . $_SESSION['language'] . '_' . $tmp_pagename,
'/c_' . $cPath,
'/' . $_SESSION['language'] . '_c_' . $cPath,
'/m_' . $manufacturers_id,
'/' . $_SESSION['language'] . '_m_' . (int)$manufacturers_id,
'/p_' . $tmp_products_id,
'/' . $_SESSION['language'] . '_p_' . $tmp_products_id
);
while(list ($key, $value) = each($sheets_array)) {
//echo "<!--looking for: $value-->\n";
$perpagefile = $template->get_template_dir('.css', DIR_WS_TEMPLATE, $current_page_base, 'css') . $value . '.css';
if (file_exists($perpagefile)) echo '<link rel="stylesheet" type="text/css" href="' . $perpagefile .'" />'."\n";
}
and replace it with this
Code:
/**
* load stylesheets on a per-page/per-language/per-product/per-manufacturer/per-category basis. Concept by Juxi Zoza.
*/
$manufacturers_id = (isset($_GET['manufacturers_id'])) ? $_GET['manufacturers_id'] : '';
$tmp_products_id = (isset($_GET['products_id'])) ? (int)$_GET['products_id'] : '';
$tmp_pagename = ($this_is_home_page) ? 'index_home' : $current_page_base;
$sheets_array = array($_SESSION['language'] . '_stylesheet',
$tmp_pagename,
$_SESSION['language'] . '_' . $tmp_pagename,
'c_' . $cPath,
$_SESSION['language'] . '_c_' . $cPath,
'm_' . $manufacturers_id,
$_SESSION['language'] . '_m_' . (int)$manufacturers_id,
'p_' . $tmp_products_id,
$_SESSION['language'] . '_p_' . $tmp_products_id
);
while(list ($key, $value) = each($sheets_array)) {
//echo "<!--looking for: $value-->\n";
$perpagefile = $template->get_template_dir('.css', DIR_WS_TEMPLATE, $current_page_base, 'css') . '/' . $value . '.css';
if (file_exists($perpagefile))
echo '<link rel="stylesheet" type="text/css" href="' . $perpagefile .'" />'."\n";
// load per-page etc stylesheets targeted to all versions of IE
$perpagefile_ie_all = $template->get_template_dir('.css', DIR_WS_TEMPLATE, $current_page_base, 'css') . '/ie_' . $value . '.css';
if (file_exists($perpagefile_ie_all)) {
echo '<!--[if IE]>' . "\n";
echo '<link rel="stylesheet" type="text/css" href="' . $perpagefile_ie_all .'" />'."\n";
echo '<![endif]-->' . "\n";
}
// load per-page etc stylesheets targeted at specific versions of IE
$ver = 5;
while ($ver <= 9) {
$perpagefile_ie_ver = $template->get_template_dir('.css', DIR_WS_TEMPLATE, $current_page_base, 'css') . '/ie' . $ver . '_' . $value . '.css';
if (file_exists($perpagefile_ie_ver)) {
echo '<!--[if IE ' . $ver . ']>' . "\n";
echo '<link rel="stylesheet" type="text/css" href="' . $perpagefile_ie_ver .'" />'."\n";
echo '<![endif]-->' . "\n";
}
$ver++;
}
}
That's it!
The following is an amended list taken from the readme fill in the 'css' folder and hopefully explains what the above changes achieve
style*.css - are always loaded and at least ONE should contain site-wide properties.
ie_style* - are always loaded and should contain only css changes and additions targeted at all versions of IE.
ie?_style* - are always loaded and should contain only css changes and additions targeted at specific versions of IE.
language_stylesheet.css - are loaded for all pages where the current language is used and should contain only css additions and changes for the current language.
ie_language_stylesheet.css - are loaded for all pages where a specific language is used and should contain only css changes and additions for that specific language targeted at all versions of IE.
ie?_language_stylesheet.css - are loaded for all pages where a specific language is used and should contain only css changes and additions for that specific language targeted at specific versions of IE.
page_name.css - are loaded for a specific page only and should contain only css additions and changes for that specific page
ie_page_name.css - are loaded for a specific page only and should contain only css additions and changes for that specific page targeted at all versions of IE.
ie?_page_name.css - are loaded for a specific page only and should contain only css additions and changes for that specific page targeted at specific versions of IE.
language_page_name.css - are loaded for a specific page only when a specific language is used and should contain only css additions and changes for that specific page and language.
ie_language_page_name.css - are loaded for a specific page only when a specific language is used and should contain only css additions and changes for that specific page and language targeted at all versions of IE.
ie?_language_page_name.css - are loaded for a specific page only when a specific language is used and should contain only css additions and changes for that specific page and language targeted at specific versions of IE.
c_??_??.css - are loaded for all info pages in a specific category only and should contain only css additions and changes for that specific category.
ie_c_??_??.css - are loaded for all info pages in a specific category only and should contain only css additions and changes for that specific category targeted at all versions of IE.
ie?_c_??_??.css - are loaded for all info pages in a specific category only and should contain only css additions and changes for that specific category targeted at specific versions of IE.
language_c_??_??.css - are loaded for all info pages in a specific category only when a specific language is used and should contain only css additions and changes for that specific category and language.
ie_language_c_??_??.css - are loaded for all info pages in a specific category only when a specific language is used and should contain only css additions and changes for that specific category and language targeted at all versions of IE.
ie?_language_c_??_??.css - are loaded for all info pages in a specific category only when a specific language is used and should contain only css additions and changes for that specific category and language targeted at specific versions of IE.
c_m_??.css - are loaded for a specific manufacturer's listing page only and should contain only css additions and changes for that specific manufacturer.
ie_m_??.css - are loaded for a specific manufacturer's listing page only and should contain only css additions and changes for that specific manufacturer targeted at all versions of IE.
ie?_m_??.css - are loaded for a specific manufacturer's listing page only only and should contain only css additions and changes for that specific manufacturer targeted at specific versions of IE.
language_m_??.css - are loaded for a specific manufacturer's listing page only when a specific language is used and should contain only css additions and changes for that specific manufacturer and language.
ie_language_m_??.css - are loaded for a specific manufacturer's listing page only when a specific language is used and should contain only css additions and changes for that specific manufacturer and language targeted at all versions of IE.
ie?_language_m_??.css - are loaded for a specific manufacturer's listing page only when a specific language is used and should contain only css additions and changes for that specific manufacturer and language targeted at specific versions of IE.
p_??.css - are loaded for a specific product's info page only and should contain only css additions and changes for that specific product.
ie_p_??.css - are loaded for a specific product's info page only and should contain only css additions and changes for that specific product targeted at all versions of IE.
ie?_p_??.css - are loaded for a specific product's info page only and should contain only css additions and changes for that specific product targeted at specific versions of IE.
language_p_??.css - are loaded for a specific product's info page only when a specific language is used and should contain only css additions and changes for that specific product and language.
ie_language_p_??.css - are loaded for a specific product's info page only when a specific language is used and should contain only css additions and changes for that specific product and language targeted at all versions of IE.
ie?_language_p_??.css - are loaded for a specific product's info page only when a specific language is used and should contain only css additions and changes for that specific product and language targeted at specific versions of IE.
I haven't fully tested absolutely every variation of the above so the usual caveats regarding backup and not testing in a live environmenet etc apply.
I hope this proves useful.
Alan
Bookmarks