Forum Moderators: coopster
template.php
<?php
header("Content-type: text/html; charset=utf-8");include("index_header.inc");
if (!isset($_GET['p'])) {
include("404.php");
} else {
include("main/" . $_GET['p'] . ".php");
}include("index_footer.inc");
?>
index_header.inc
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<style type="text/css"><!-- @import url(_blah.css); --> </style><title>Blah Blah</title>
<?php
include 'database_stuff.php';
include 'database_stuff.php';
include '_stuff.inc';
?></head><body>
<div align="center">
<div id="logo"> </div>
<div id="holder" align="left">
<div id="menu">** The menu, which shows up on every page and is floated to the right so comes before the content.**
</div>
<div id="content">
I first thought I could declare the title in each page and then simply call it up in the title tags.
[quote]<title> <?=$title;?> </title>[/quote] But because the content page is processed after the index_header page, the title has no value.
I'm stumped about what to do.
$title = "My Page Title";
include('index_header.inc');
Since you want each page to have its own title, you shouls have a way to determinate the page title by the page name - $_GET['p']
Just a very simple example:
$title = ucfirst($_GET['p']);
include('index_header.inc');
Or if you have an array of page/title pairs:
$page_titles = array("about"=>"About us page", "index"=>"Welcome", "contact"=>"Contact us");
and $_GET['p'] = "about";
$title = $page_titles[$_GET['p']];
include('index_header.inc');