Changing template, depending on browser

Random stuff about serendipity. Discussion, Questions, Paraphernalia.
Post Reply
Hokey
Regular
Posts: 141
Joined: Wed Dec 14, 2005 3:36 pm
Location: Germany
Contact:

Changing template, depending on browser

Post 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?
costa
Regular
Posts: 110
Joined: Wed Feb 08, 2006 5:29 pm
Location: Poland
Contact:

Post 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
"everything is under control" - kasparov demo
Hokey
Regular
Posts: 141
Joined: Wed Dec 14, 2005 3:36 pm
Location: Germany
Contact:

Post by Hokey »

Thank you Costa. That helped and all users can use the same template!

Regards,
Hokey
carl_galloway
Regular
Posts: 1331
Joined: Sun Dec 04, 2005 5:43 pm
Location: Andalucia, Spain
Contact:

Post 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...
Post Reply