View Single Post
Old 01-02-2009, 10:08 AM   #1 (permalink)
sarmenhb
The Addict
 
sarmenhb's Avatar
 
Join Date: Jan 2008
Location: los angeles
Posts: 309
Thanks: 44
sarmenhb is on a distinguished road
Default what method do you use with php when displaying a stylesheet?

this is how i display a style sheet for whatever browser that opens the page.

Code:
function style() {
$browser = $_SERVER['HTTP_USER_AGENT'];
if(preg_match('/MSIE6.0/',$browser)) {
echo "ie6.css";
}

if(preg_match('/Firefox/',$browser)) {
echo "firefox.css";
}
}

//then in the html i put something like this

<head>
<link href="css/<?php style(); ?>" type="text/css" rel="stylesheet">
</head>
is there a better method to do than doing it this way? since this is the only way that i know i'm wasting more time by creating a stylesheet for every browser that exists than finding another way.

whats another way of doing this??


thanks
__________________
no signature set
sarmenhb is offline  
Reply With Quote