Help with PHP CSS selector
| From: | Brian Tegtmeier | Date: | Sun, 28 Oct 2001 21:36:14 +0000 |
| Subject: | Help with PHP CSS selector | ||
| Groups: | php.db | ||
| Request: | Send a blank email to php-db+get-13785@lists.php.net to get a copy of this message | ||
Currently I have PHP code that runs a server side check on your browser (placed above the
<html> tags) and assigns a certain CSS stylesheet to it. The problem I have with the current
code is it only goes by the browser and not both the browser and platform. I have the source code
(listed below) that shows what the selector does. I was wondering if any of you could take a look at
this and give some suggestions to have it run multiplatform (Windows and Mac) and have stylesheets
for each like ie_win.css for IE on Windows and ie_mac.css for IE on Mac and so on. Thanks :)
<?php
$browser = getenv("HTTP_USER_AGENT");
if (preg_match("/MSIE/i", "$browser")) {
$css = "<link rel="stylesheet" href="ie_win.css"
type="text/css">";
} elseif (preg_match("/Mozilla/i", "$browser")) {
$css = "<link rel="stylesheet" href="ns4_win.css"
type="text/css">";
} if (preg_match("/Mozilla\/5.0/i", "$browser")) {
$css = "<link rel="stylesheet" href="ns6_win.css"
type="text/css">";
} elseif (preg_match("/opera/i", "$browser")) {
$css = "<link rel="stylesheet" href="op_win.css"
type="text/css">";
}
?>
--
_______________________________________________
Sign-up for your own FREE Personalized E-mail at Mail.com
http://www.mail.com/?sr=signup
Have you downloaded the latest calling software from Net2Phone? Click here to get it now!
http://www.net2phone.com/cgi-bin/link.cgi?157