Options

Classing People Pages

edited September 2006 in Vanilla 1.0 Help
I'm working with a heavily modified Vanilla theme, in order to integrate it with an existing site. The theme currently has a problem in IE that only effects the people pages. I know how to fix the problem; the issue is in how the CSS fix should be deployed. I have a stylesheet that's included using conditional comments specifically for IE hacks; normally I'd just plop the CSS fix in there and go. But since this problem is only on the people pages, I need something specific to them so that the fix doesn't skew the pages that are displaying correctly. Consequently there are two ways around this that I've come up with: 1) Have a people-ie.css that only loads on the People pages. Presumably would mean hacking the $StyleSheet array. 2) Figure out some way to have the <body> class set to "People" on all the People pages. That would allow me to prefix the CSS fix with ".People". So... did I miss an easy fix? If not, which of the two above would be the easiest/best to implement?

Comments

  • I would go for 1) and add somewhere like in an extension:
    if ($Context->SelfUrl == "people.php") $Head->AddStyleSheet(/path/to/people-ie.css);
  • edited September 2006
    The only problem I've run into in creating the extension: how to put the stylesheet inside a conditional comment?

    Rather than relying on CSS hacks (which may break as IE 7 rolls out), I usually go Microsoft's recommended route and use conditional comments to expose my IE-only stylesheet to pre-7 IE:

    <!--[if lt IE 7]> <link href="/styles/ie.css" rel="stylesheet" type="text/css" media="screen" /> <![endif]-->

    If I use the AddStyleSheet, then it seems like I'm forced to rely on CSS hacks to hide my IE-specific CSS from other browsers.
  • edited September 2006
    if ($Context->SelfUrl == "people.php") $Head->AddString('<!--[if lt IE 7]><link href="/styles/ie.css" rel="stylesheet" type="text/css" media="screen" /><![endif]-->');
    tada...
  • FYI, for the time being I'm using the Star HTML (* html) hack to hide the CSS from other browsers.
This discussion has been closed.