...

View Full Version : Controlling cross browser compatibility by php



deshi2003
08-29-2009, 09:02 AM
Hy all,
i think u all are doing better. please give me a suggestion.

you all aware about cross browser issue and the disturbance of internet explorer. when there is a scene where firefox and internet explorer is showing different output or need different padding, margin i use php to control it. like



$agent=$_SERVER['HTTP_USER_AGENT'];
//echo $agent;
$t= strpos($agent,"Firefox");

<span <?php if($t) echo "style='padding-left:680px'"; else echo "style='padding-left:640px'" ;?> Home</span>


now you it is better practice to control CSS across browsers by using PHP or there is anything better to control it.

*****give me some link of good website where would i get huge cross browser issues.

Phil Jackson
08-29-2009, 10:33 AM
<?php
ereg('MSIE ([0-9]\.[0-9])',$_SERVER['HTTP_USER_AGENT'],$reg);
if(!isset($reg[1]))
{
$version = "not IE";
}
else
{
$version = $reg[1];
}
?>

$version will either be "not IE" or "6", "7", "8" you get the picture.

This is not the way to sort you problems though.

Zangeel
08-29-2009, 11:28 AM
I think php is an overkill, firstly, using a stylesheet is much better, and HTML allows you to add conditionals much easier than SS programming languages.

For example



<!--[if IE 6]>
Do this if theyre using IE 6 .. most would use this to include a stylesheet specifically for ie 6
<![endif]-->

Fou-Lu
08-29-2009, 12:05 PM
I think php is an overkill, firstly, using a stylesheet is much better, and HTML allows you to add conditionals much easier than SS programming languages.

For example



<!--[if IE 6]>
Do this if theyre using IE 6 .. most would use this to include a stylesheet specifically for ie 6
<![endif]-->



I was thinking the same, why use PHP to do the extra work when there are good IE hacks to use?

abduraooft
08-29-2009, 12:17 PM
give me some link of good website where would i get huge cross browser issues. If your markup is perfect, then you don't generally need many hacks for your pages. On the other hand, if your markup is big mess, then no one (among PHP, CSS/javascript hacks, conditional comments) can save you.

With that said, could you post a link to your page?

Phil Jackson
08-29-2009, 12:28 PM
**waits for link to be posted**



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum