Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

If this Page Show This Else Show This

On all pages apart from the contact page, I want it to show the following in the inc-header.php include.

<p><a href="contact.php">Contact</a></p>

On the page contact.php, I want it to show:

<p><a href="index.php">Home</a></p>

This should be possible correct?

like image 565
Jezthomp Avatar asked Nov 03 '11 14:11

Jezthomp


2 Answers

<?php
if (stripos($_SERVER['REQUEST_URI'], 'contact.php')){
     echo '<p><a href="index.php">Home</a></p>';
}
else{
     echo '<p><a href="contact.php">Contact</a></p>';
}
like image 140
genesis Avatar answered Oct 01 '22 06:10

genesis


if ($_SERVER["SCRIPT_NAME"] == '/contact.php') {
    echo '<p><a href="index.php">Home</a></p>';
} else {
    echo '<p><a href="contact.php">Contact</a></p>';
}
like image 39
cweiske Avatar answered Oct 01 '22 06:10

cweiske