Show piece of html only on homepage

Discussion in 'PHP' started by WharfeValley Systems, Jan 28, 2011.

  1. #1
    Im fairly sure this is easy but its slipping my mind

    I want to show a piece of html code, but only if the page is the homepage. Will be going in the footer which is across all pages.

    No CMS, just template files
     
    WharfeValley Systems, Jan 28, 2011 IP
  2. MyVodaFone

    MyVodaFone Well-Known Member

    Messages:
    1,048
    Likes Received:
    42
    Best Answers:
    10
    Trophy Points:
    195
    #2
    Something like this might work:

    
    <?php
    if($_SERVER['REQUEST_URI'] == "/index.php"){
    echo "content";
    } else {
    // add something here if you like
    }
    ?>
    
    PHP:
     
    MyVodaFone, Jan 28, 2011 IP
    WharfeValley Systems likes this.
  3. jsimpson

    jsimpson Peon

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Try putting it on a text box or something..
     
    jsimpson, Jan 28, 2011 IP
  4. G3n3s!s

    G3n3s!s Active Member

    Messages:
    325
    Likes Received:
    4
    Best Answers:
    0
    Trophy Points:
    80
    #4
    text box? This is PHP section, so MyVodaFone is correct...
     
    G3n3s!s, Jan 28, 2011 IP
  5. WharfeValley Systems

    WharfeValley Systems Active Member

    Messages:
    1,515
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    80
    #5
    Awesome mate, worked a treat. I knew it was something simple just couldnt remember exact syntax.
    +Rep

     
    WharfeValley Systems, Jan 31, 2011 IP