This is an elementary question, but I've not been able to find the
answer, so here goes:
I am developing a site using php. I have the html header information
in a file that I include in all the pages using the require_once
function.
That is, each page includes the line
<?require_once('PageStart.php')?>
The PageStart.php file essentially defines the header. Omitting the
boring stuff, it's laid out like so:
<html>
<head>
<title>The Title of the Page</title>
<?require_once('styles/PageStyles.css')?>
</head>
<boring stuff snipped>
This works great. The only complaint I have is that there are LOTS of
pages on the site, and using this approach means that every page is
titled "The Title of the Page" When scanning my browser history, I
could have surfed to 30 different pages in the site and they all have
the same title. Makes it hard to know which page I'd like to go back
to.
I'd like to have a way to pass a (sometimes) dynamically generated
page title to the PageStart.php file. I say sometimes because certain
pages (the Main one for example) will always have the same title, so
that could be passed statically. There is another series of pages in
which the same php file accesses a MySQL database to display
information about various family members, and I'd like that title to
be generated dynamically (for example, "All about Mary" or "All about
Ted" depending on the person being described in the page).
Now I KNOW that with php there's a way to do this. I just can't find
it.