Page 1 of 1

Smarty Variables in a stylesheet - Browser Sniff

Posted: Thu May 25, 2006 3:23 pm
by MikePearce
Hi all,

Sorry if this has been answered before, I have searched but couldn't find an answer.

Is it possible to use smarty variables/functions in a stylesheet?

Alternatively, is there a way I can show different browsers different stylesheets? Or just slightly modified stylesheets?

Cheers,

Mike

Re: Smarty Variables in a stylesheet - Browser Sniff

Posted: Thu May 25, 2006 5:20 pm
by tsw
You can use css hacks to have different rules for IE like holly hack

http://www.communitymx.com/content/arti ... &cid=C37E0

or conditional comments

http://www.quirksmode.org/css/condcom.html

or you can create new stylesheet and not assosiate it with your template and create used defined tag to check browser

Code: Select all

if(isset($_SERVER['HTTP_USER_AGENT']) && preg_match('/MSIE/', $_SERVER['HTTP_USER_AGENT']))
{
echo "<link rel="stylesheet" type="text/css" href="/stylesheet.php?name=yourstylesheetname" />
}
still the best option is to try create css that works in every browser ;)

Re: Smarty Variables in a stylesheet - Browser Sniff

Posted: Thu May 25, 2006 9:08 pm
by Ted
As far as smarty variables on stylesheets, currently no.  None of that stuff is run through smarty because of the nasty issues that would come from the { } stuff.