tr88
tr88

Reputation: 57

Combining a header and modifying for each page

I currently have multiple pages for my website. I currently am using no header for each page because the links change on each page.

Example: if I am on the home page and click on a Testimonial tab, I don't want the Testimonial tab to still be there once I am redirected to that page, since I am already on that page!

How can I do create a single header file that gets modified on each page. Can this be done in php or javascript

Upvotes: 0

Views: 40

Answers (1)

av192
av192

Reputation: 482

Use php using your current location as follows

<?php
   $page=$_SERVER["REQUEST_URI"];
 ?>

 <?php if (strcmp($page, "/testimonial") !== 0)
  {
 ?>
     <li class="testimonial"><a src="">link</a></li>
 <?php 
  }
 ?>

Compare it to the page you want it to be, and decide if you want to display it or not

Upvotes: 1

Related Questions