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 3 of 3
  1. #1
    New Coder
    Join Date
    Mar 2004
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Different Include based on Browser Type

    Hello Everyone,

    I'm trying to detect browser type and include different menu files based on the browser type. This is what I'm doing:

    <?php
    if (!(strpos($HTTP_USER_AGENT,'Mozilla/5') === false)) {
    echo("<? include('menunet.php') ?>");
    } else {
    echo("<? include('menu.php') ?>");
    }
    ?>

    Unfortunately it's not including anything at all. I've tried various methods, as well as using a similiar method in Javascript but I'm getting the same result each time - nothing shows. Is it possible to do it this way, or am I going in the wrong direction? I've also tried to do the detection inside of the menu.php file and echo out the appropriate code - but it's lengthy and doesn't seem to work, either. As always, your expertise is appreciated.

    Thanks

    Luke

  • #2
    Regular Coder
    Join Date
    Apr 2004
    Location
    Philadelphia
    Posts
    241
    Thanks
    2
    Thanked 5 Times in 5 Posts
    you dont echo include get rid of echo put
    <?php
    if (!(strpos($HTTP_USER_AGENT,'Mozilla/5') === false)) {
    include("menunet.php");
    } else {
    include("menu.php");
    }
    ?>

  • #3
    New Coder
    Join Date
    Mar 2004
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Works perfectly. Thank you very much!

    Luke


  •  

    Posting Permissions

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