How can I get IE6 to render the handheld layout instead of default?

Elegant Joomla template designed especially for both professional and personal website presentation.
GK User
Sat Oct 30, 2010 8:03 pm
Hi,

I'm using the Postnote template and I have enabled "Use override.css" to keep my changes separate from the template to allow for easy template upgrades. The problem is when I enable "Use override.css", rendering my website on IE6 results with the following error:

"Fatal error: Call to a member function addStylesheet() on a non-object in /home/<<my own path>>/templates/gk_postnote/layouts/blocks/head.php on line 83"

If I turn "Use override.css" off, the website doesn't generate this error and does show in IE6.

I don't want to support showing the full desktop website in IE6, however I do want users that are stuck with IE6 (which is still 25% because of corporate IT departments have customised IE6 intranet applications that won't work with newer IE7+ browsers or other browsers) to be able to read the content of the website instead of getting a fatal error.

The Postnote template is able to choose a layout depending on the browser agent, with options for default, iPhone and other handheld devices. Is it possible to add an extra option to choose a different layout if IE6 is detected, for example, I'd like the handheld layout to be used with IE6 is detected. This way, support for IE6 can be dropped from the default layout completely, and IE6 users can fall back onto the handheld layout so that users can at least view the most important content on the website.

Thanks,
Dave.
User avatar
Senior Boarder

GK User
Fri Nov 05, 2010 4:50 am
To overcome the following error on IE6:

"Fatal error: Call to a member function addStylesheet() on a non-object in /home/<<my own path>>/templates/gk_postnote/layouts/blocks/head.php on line 83"

I've edited /home/<<my own path>>/templates/gk_postnote/layouts/blocks/head.php and moved line 83:

"<?php if($this->getParam('css_override')) $document->addStylesheet($this->templateurl() . '/css/override.css'); ?>"

to immediately after:

"<?php

$document->addScript($this->templateurl() . '/js/gk.script.js');

?>"

This new position for the override.css no longer generates the fatal error and allows the page to render on IE6.

Kind regards,
Dave.
User avatar
Senior Boarder

teitbite
Sat Nov 06, 2010 1:14 pm
Hi

Very clever. Grats.
User avatar
Moderator

GK User
Wed Nov 10, 2010 10:14 am
I'm still trying to get the template to use the "handheld" layout if IE6 is detected. I've currently determined that the code that selects the layout is located within the following file:
gk_postnotelibsmobile_device_detect.php

However, what's the best way to determine whether IE6 is being used and not another browser that includes the "MSIE 6." user agent (eg. Opera and other browsers)?

Kind regards,
Dave.
User avatar
Senior Boarder

teitbite
Fri Nov 12, 2010 3:48 pm
Hi

I've done this for myself to recognize IE6. Maby You will be able to use it:

Code: Select all
   if( substr_count( $_SERVER['HTTP_USER_AGENT'], 'MSIE 6.0' ) ) {
      
   } // eof if()
User avatar
Moderator

GK User
Sat Nov 13, 2010 5:16 pm
Here's the code I ended up using:
Code: Select all
if(preg_match('/bmsie [1-6]./i', $useragent) && !preg_match('/b(opera|msie [789])/i', $useragent))

This has based from:
http://stackoverflow.com/questions/671890/can-i-detect-ie6-with-php
Kind regards,
Dave.
User avatar
Senior Boarder

teitbite
Sun Nov 14, 2010 10:10 pm
Hi

Hehe. That is much more accurate than my code :)
User avatar
Moderator


cron