Most of the pages on my site follow the simple pattern:
<?
require('scriptfiles/header.inc');
?>
HTML PAGE
<?
require('scriptfiles/footer.inc');
?>
This of course means that every page has the same title. Well, now I want to change the titles for all the pages on my site individually, to reflect what they contain.
I was thinking of changing each file to start something like:
<?
$title = "Books";
require('scriptfiles/header.inc');
?>
and in the header file, having a line like:
<title><?= $title ?></title>
But this would mean opening >100 pages and changing them one by one... not a task I'm looking forward to.
Does anyone know a better method?
I was thinking maybe, if there is a way to recognise what page REQUIREd another file, the header file could contain a switch statment like:
case 'books.php':
echo "<title>books</title>
break;
case 'shoes.php':
echo "<title>shoes</title>
This would mean I could keep everything at a central location for easy editing.
But I dont know if it's possible that a page can know who REQUIRED it.
If anyone's got an idea, I'd love to hear it.
Cheers
PS. Databases are out of the question as i have no SQL support.