treehouse : what would you like to learn today?
Web Design Web Development iOS Development

If on a certain page display a certain link

  • Hello, would anyone know what lines of php I could put in my header which would show a certain link if you are on a certain page?

    Eg. If you are on the "Home" page display this link. If you are on the "Contact" page display this link?

    Thank you,
    Marissa
  • Any PHP site? Or a particular platform.....Wordpress?
  • basic example:


    $setPage = $_SERVER['PHP_SELF'];
    $currPage = trim($getPage, '/');

    if($currPage == 'WTFOMG.php'){
    echo 'do some stuff';
    }elseif($currPage == 'GMOFTW.php'){
    echo 'ffuts emos od';
    // echo out a link or something fun and creative
    }