• Hi I have a a wordpress mu site that was serving 3 different themes to US, UK and Australia. All data now comes from one site. I want to display different content for each contact page for each country..

    Something similar to this:

    <?
    
    if url="page1.php" then print("hi");
    if url="page2.php" then print("hello");
    if url="page3.php" then print("howdy");
    
    ?>

    Advice greatly appreciated 🙂

Viewing 1 replies (of 1 total)
  • Since I don’t know what your actual URL will contain, or how you will get the URL, I can only give a general spproach.

    <?php
    $uri = $_SERVER['REQUEST_URI'];
    if ( strpos($uri,'page1.php') !== false ) {
       echo 'hi';
    } elseif ( strpos($uri,'page2.php') !== false ) {
       echo 'hello';
    } elseif ( strpos($uri,'page3.php') !== false ) {
       echo 'howdy';
    } else {
       echo 'unknown uri';
    }
    ?>
Viewing 1 replies (of 1 total)

The topic ‘PHP If url Statement’ is closed to new replies.