I am creating a fixed header for all my website's pages.
I want to include a page title in each index.php which is part of the page's header, coded in an included header.php, The page title should be declared on the page itself and then referenced in the static header.php file for css and such.
My current method looks something like this between two files (index.php and header.php):
index.php:
<html>
<title>Site Title</title>
<?php
$pageTitle="About";
?>
<link rel="stylesheet" href="style.css">
<?php include_once("header.php"); ?>
<body> ...
header.php:
<div id="pageTitle">
<?php function getText() {echo $pageTitle;}
getText();
?>
</div>
How should the files be modified to pass the pageTitle variable into the included header.php file?