Hey, IE users: why did none of y'alls tell me my site's been borked since launch day?
It's okay. I forgive you. Just lemme explain what happened.
I'm using ExpressionEngine's conditional tags on the URL of every page you visit here. I use these on EE's segment variables. The way things work here, both secondary (like the /articles/ page) and tertiary (like /articles/some_article) page are served up by the same template. Within that template is a conditional that says "if there's no third part to the URL, use one part of the template to render the requested page. If there is, use another.
The day after launch, I ran into a problem. Pagination – which I hadn't tested to that point – didn't work. When a user hits the "next" button, a number prefixed by the letter "P" gets added to the URL. Basically, I wanted the template to display this page as if that extra URL segment never existed.
So I did something like this:
<body id="{if segment_2 == ""}// Show as single page content.{if:elseif}<?php// Test the second segment with preg_replace and display the correct template.?>{/if}">
The problem is this: ExpressionEngine apparently needed me to add a carriage return after I closed the php statement before I ended that EE conditional. This meant that the final HTML rendered like this:
<body id="interior">
It validates fine. And every browser was happy with it, except IE. It completely ignored the opening body tag, which was a major problem since much of the basic layout rules here are at TNF are assigned via the id applied to that element.
My solution was kludgey but functional: just put the closing bracket for that body tag at the end of every instance of the id value. It's repeated code, so it's annoying, but an unborked site is a happy site.
Lesson learned. It's not the kind of thing I guess will ever get addressed in IE – especially because I'm not even sure if the validator is right on this one – but it sure would be nice if they did.






Comments
Whaddya think?