Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Mar 2009
    Posts
    74
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Controlling cross browser compatibility by php

    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

    PHP Code:
     $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.

  • #2
    Senior Coder
    Join Date
    Aug 2009
    Location
    Mansfield, Nottinghamshire, UK
    Posts
    1,555
    Thanks
    57
    Thanked 148 Times in 147 Posts
    PHP Code:
    <?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.
    Last edited by Phil Jackson; 08-29-2009 at 10:35 AM.

  • #3
    Regular Coder Zangeel's Avatar
    Join Date
    Oct 2007
    Location
    public_html/
    Posts
    638
    Thanks
    17
    Thanked 79 Times in 79 Posts
    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

    Code:
    <!--[if IE 6]>
    Do this if theyre using IE 6 .. most would use this to include a stylesheet specifically for ie 6
    <![endif]-->
    PHP Code:
    $aString is_string((string)array()) ? true false// true :D 
    [/CENTER]

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    Quote Originally Posted by Zangeel View Post
    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

    Code:
    <!--[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?
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 
    Been gone for a few months, and haven't programmed in that long of a time. Meh, I'll wing it ;)

  • #5
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,861
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    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?
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #6
    Senior Coder
    Join Date
    Aug 2009
    Location
    Mansfield, Nottinghamshire, UK
    Posts
    1,555
    Thanks
    57
    Thanked 148 Times in 147 Posts
    **waits for link to be posted**


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •