I typically do something like this, BEFORE any HTML content is generated:
// grab the name of the file requested by the browser:
switch(basename(__FILE__)) {
case "login.php":
$title = "Please Log In";
break;
case "about.php":
$title = "All About Our Stuff";
break;
case "manual.php":
$title = "Read the Manual";
break;
default:
$title = "Welcome to my web site";
}
// Later, when the page is generated, set the HTML title:
echo "<html">;
echo "\n<head>";
echo "\n<title>$title</title>";
echo "\n</head>";
Hope this helps...