Page 1 of 1

Changing template, depending on browser

Posted: Thu Sep 14, 2006 7:33 am
by Hokey
Hi out there!

I have a special wish tody... I am using the smallbiz-template, which is very great but doesn't work good with the Internet Explorer, because IE has problems with the right sidebar.

Is there any possibility to change the template only for IE-Users?

Posted: Thu Sep 14, 2006 8:44 am
by costa
i don't know about how about a whole template but you can easily "tweak" carl's template's styles.css for IE only and redefine styles for sidebars only to suit your (and IE's :)) needs.

in index.tpl find line similiar to this one:

Code: Select all

<link rel="stylesheet" type="text/css" href="{serendipity_getFile file="style.css"}" />
and AFTER it put a line like that

Code: Select all

<!--[if lte IE 6]><link rel="stylesheet" href={serendipity_getFile file="style_ie.css"} /><![endif]-->
if browser you're using is IE 6 - a file called "style_ie.css" will be loaded AFTER loading of common "style.css". in style_ie.css you can redefine all the styles you need for IE. remember thought - if you define a style first in style.css (which is loading before style_ie.css) all the definitions for a given class or id will be remembered and used by browser.

more on this you'll find here:
http://www.quirksmode.org/css/condcom.html

Posted: Thu Sep 14, 2006 9:21 am
by Hokey
Thank you Costa. That helped and all users can use the same template!

Regards,
Hokey

Posted: Thu Sep 14, 2006 9:21 am
by carl_galloway
Or you could use

Code: Select all

{$smarty.server.HTTP_USER_AGENT}
to determine the exact browser name, then assign a different template based on the result of this, but this approach would require a lot more work than Costa's suggestion. I've actually been thinking of doing something with this in the header of a template, just to make the user's experience more personal but...