eh, why not just use all PHP? Less code goes to the browser and makes for faster pages and cleaner code and works more. I do something like this in my CSS doc...
<?php
$FireFox = (strpos($_SERVER['HTTP_USER_AGENT'],'Firefox') !== FALSE);
$MSIE7 = (strpos($_SERVER['HTTP_USER_AGENT'],'MSIE 7') !== FALSE);
if($FireFox || $MSIE7)
{
?>
//css
<?php
}
?>
- <?php
- $FireFox = (strpos($_SERVER['HTTP_USER_AGENT'],'Firefox') !== FALSE);
- $MSIE7 = (strpos($_SERVER['HTTP_USER_AGENT'],'MSIE 7') !== FALSE);
- if($FireFox || $MSIE7)
- {
- ?>
- //css
- <?php
- }
- ?>
You're actually better off calling your CSS page like style.css.php and then sending this before any output:
<?php
header('Content-type: text/css');
$FireFox = (strpos($_SERVER['HTTP_USER_AGENT'],'Firefox') !== FALSE);
$MSIE7 = (strpos($_SERVER['HTTP_USER_AGENT'],'MSIE 7') !== FALSE);
if($FireFox || $MSIE7)
{
?>
style { font-size: 5px; }
.fake_class { color: #FF0000; }
/* etc... */
<?php
}
?>
- <?php
- header('Content-type: text/css');
- $FireFox = (strpos($_SERVER['HTTP_USER_AGENT'],'Firefox') !== FALSE);
- $MSIE7 = (strpos($_SERVER['HTTP_USER_AGENT'],'MSIE 7') !== FALSE);
- if($FireFox || $MSIE7)
- {
- ?>
- style { font-size: 5px; }
- .fake_class { color: #FF0000; }
- /* etc... */
- <?php
- }
- ?>
Then you can just have the same file for all browsers with <link>. Oh if you're really picky you could use stripos instead of strpos too, I think it might be faster.
There's no place like 127.0.0.1, badass part is now it's ::1