Skip to content

Templates icon

Making Your Mambo IE6 Template Work With IE7

Many Mambo templates were designed to run in quirks mode under Internet Explorer 6. This tutorial explains how to reduce compatibility problems with Internet Explorer 7.

IE6 gave template designers the option to render their sites in either standards mode or what is called quirks mode. Quirks mode is a backwards compatible mode, which means that sites that ran under quirks mode had fewer compatibility problems with older versions of IE.

To trigger quirks mode in IE6 all a designer had to do was to include the xml declaration, eg:
<?xml version="1.0" encoding="utf-8"?>

In IE7, Microsoft removed the ability for the xml declaration to trigger quirks mode. However, because IE7 is still not Standards-compliant (it is marginally better than IE6 in its handling of Standards and CSS) many sites still need to trigger this backward compatibility mode.

The only way to force IE7 to render a site in quirks mode, without affecting the way other browsers render a site, is by including a comment between the xml declaration and the doctype.

This is done like this:

<?xml version="1.0" encoding="utf-8"?>
<!– any comment you like will keep IE7 in quirks mode –>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

Now, keep in mind the simple rule:

  1. If your template uses the xml declaration, the comment must come AFTER the xml declaration and before the doctype.
  2. If your template is HTML or XHTML sent as text/html and does NOT use the xml declaration, that is - it starts with the doctype being the first line in the template's index.php, then you place a comment above this. So, the comment will then be the first line in your template's index.php, followed by the doctype.

Both ways will tell IE7 to render the site in quirks mode and will reduce the problems caused by incompatibilities.

You can write anything you like in the comment as long as it is a valid comment and is placed into the correct position in your template's index.php file. Just make the comment meaningful so you will remember why you put it there.

Bookmark This:
  • bodytext
  • Technorati
  • del.icio.us
  • Facebook
  • Google
  • StumbleUpon
  • Reddit

Whether I am developing Mambo or working on tutorials I am fuelled by coffee. Caffeine keeps me going so if you like the work I am doing please click on the cup to buy me a coffee today. Just $10 covers the cost of getting my caramel macchiato ;)

If you enjoyed this article make sure you subscribe to my RSS feed!

Leave a Reply

This is a gravatar-friendly site, enter your email address to use your gravatar.

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

By submitting a comment here you grant this site a perpetual license to reproduce your words and name/web site in attribution.