1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Browser specific external css links

Discussion in 'PHP' started by whirlybird20, Jul 16, 2008.

  1. #1
    How can I use php to load one external stylesheet for internet explorer 6 and bellow, and another stylesheet for everything else?
     
    whirlybird20, Jul 16, 2008 IP
  2. matthewrobertbell

    matthewrobertbell Peon

    Messages:
    781
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Use $_SERVER['HTTP_USER_AGENT'] to check the user agent, maybe with preg_match.
     
    matthewrobertbell, Jul 16, 2008 IP
  3. MartinGr

    MartinGr Peon

    Messages:
    38
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #3
    http://rafael.adm.br/css_browser_selector/ might help you :)
     
    MartinGr, Jul 16, 2008 IP
  4. revvi

    revvi Peon

    Messages:
    58
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Great resource. Thanks.:)
     
    revvi, Jul 16, 2008 IP
  5. whirlybird20

    whirlybird20 Guest

    Messages:
    462
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I would rather use the $_SERVER['HTTP_USER_AGENT'] method then the javascript method. Can anyone tell me how to do this?

    Thanks!
     
    whirlybird20, Jul 16, 2008 IP
  6. matthewrobertbell

    matthewrobertbell Peon

    Messages:
    781
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    0
    #6
    PM sent with code.
     
    matthewrobertbell, Jul 16, 2008 IP
  7. whirlybird20

    whirlybird20 Guest

    Messages:
    462
    Likes Received:
    11
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Thank you matthewrobertbell!

    I have included the code that you sent me bellow for anyones else who wants to do this.

    Joel

    if (preg_match('/firefox/i',$_SERVER['HTTP_USER_AGENT']) {
    //print code for firefox css
    }
    Code (markup):
     
    whirlybird20, Jul 16, 2008 IP