I have a block of html code that for the header of all my pages. It is in a file called header.php that is inserted into all of my pages by using
<?php require("http://www.the5thfloor.net/180wired/header.php"); ?>
It includes everything from the <html> tag to the <td> tag in the body of my page where I start my content. On two of my pages, I need a javascript code inside the <head></head> tags of my site. Instead of having the javascript code appear on every page, I only want it to appear on the pages I want it to. I have this php code in my header.php file
<?php
$filename = basename($_SERVER['PHP_SELF']);
switch ($filename)
{
case "staff.php":
require("http://www.the5thfloor.net/180wired/staff.htm");
break;
case "guestbook.php":
require("http://www.the5thfloor.net/Guestbook/guestbook.htm");
break;
default:
}
?>
with the javascripts in the staff.htm and guestbook.htm files. The problem is that the php of header.php is evaluated before it is inserted into the individual pages. This means that $filename is "header.php" everytime.
How can I get the header.php file to get inserted into the individual pages before the php code of the header.php file is evaluated?