Paul Posted October 12, 2011 Share Posted October 12, 2011 Hi all, I have used the following header include on every webpage, including the homepage: <?php # header.html // This is the include for the header for each page. // It starts output buffering and initialises a session. // It assigns a page title. ob_start(); session_start(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title> <?php echo $page_title; ?> </title> </head> <body> <h1>The banner will go here</h1> <h3>Main menu</h3> <a href="../curtains.php">Curtains</a><br /> <a href="../rblinds.php">Roman Blinds</a><br /> <a href="../other_soft_furnishings.php">Other Soft Furnishings</a> I'm trying to add a page title to each page of a website by using the following code on each page. This one is for the curtains page: //Page title $page_title = "Di's Soft Furnishings - Curtains"; include ('includes/header.html'); Right. Here's the problem. When I load the homepage and say the curtains pages seperately the page title bit works and the relevant title appears at the top of the browser tab. However if I load the hompage first and then use the 'curtains' link then the title does not appear at the top of the curtains page. Is it something to do with the fact that I have included the links within the header include? I can't see why that would make a difference but something is? Cheers Paul Link to comment Share on other sites More sharing options...
Paul Posted October 12, 2011 Author Share Posted October 12, 2011 Hi again, Ignore this post I've realised what I've done. I'm using localhost and I made changes to the linked pages and then tried to access them from the homepage without having sent them to the remote server. So, in effect, the link was linking to an outdated file. I've run the linked files through localhost and now the links work correctly. Paul Link to comment Share on other sites More sharing options...
Larry Posted October 12, 2011 Share Posted October 12, 2011 Ah, that can happen. Kudos for figuring it out and thanks for letting us know it's working now. Link to comment Share on other sites More sharing options...
Recommended Posts