PHP question - pls help

Discussion in 'PHP' started by jasonsc, Jun 29, 2007.

  1. #1
    I have a wordpress template where I have this code in the header:

    </div>
    <?php } ?>

    <?php if(preg_match('/MSIE/', $_SERVER['HTTP_USER_AGENT'])) { ?>
    <div id="firefox_check">
    MY TEXT COMES HERE
    </div>
    <?php } ?>

    Basicly this checks the browser and if it is MS IE it will display "MY TEXT COMES HERE" in the blog.

    How do I do that it will ALWAYS display the text , no matter what the browser is?

    Probably a stupid question, but I don't understand php and css.

    Reps given!
     
    jasonsc, Jun 29, 2007 IP
  2. wing

    wing Active Member

    Messages:
    210
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    58
    #2
    Strip off some phpcode:

    <?php if(preg_match('/MSIE/', $_SERVER['HTTP_USER_AGENT'])) { ?><div id="firefox_check">
    MY TEXT COMES HERE
    </div>
    <?php } ?>

    This is what should be left:

    <div id="firefox_check">
    MY TEXT COMES HERE
    </div>

    :)
     
    wing, Jun 29, 2007 IP
    jasonsc likes this.
  3. jasonsc

    jasonsc Well-Known Member

    Messages:
    1,696
    Likes Received:
    56
    Best Answers:
    0
    Trophy Points:
    165
    #3
    Thanks man, I actually tried that before, but forgot to remove the <?php } ?> and it made my whole blog crash. Now it works great!

    Rep given!
     
    jasonsc, Jun 29, 2007 IP