The magic words are
basename and
php_self. These give you, respectively, the name of the current page-- that is, the html/php page that
calls your header script, not the file that holds the script itself-- and the full filepath.
For your purposes you probably just need the pagename. Unless a lot of your pages are called "index.html" (physical filename, not URL) because they're in different directories. Then you have to either get creative, or put it in the code manually, like "include blahblah header.php?page=widgets". For just 29 pages, doing this part manually isn't unreasonable.
That's assuming you're using php includes. If the only thing you'll be doing with php is making these navigation headers and footers, it
may be simpler to configure both as SSIs. The magic word then becomes ${DOCUMENT_NAME}. I don't know whether parsing a whole page as php is significantly more work for the server than including a file. On the 29-page scale, it's probably more a matter of which form you're more comfortable with.
Either way, the php itself will have an if/then package that can be as simple or as complicated as you like.* Mine just loop through all page titles in a directory, like (cut and paste, sorry):
if ($pagename[$count][0] == $word)
{ echo $pagename[$count][1]; }
else
{ echo more-complicated-stuff-here }
I may be doing the opposite of what you're aiming for, but the concept is the same: do one thing if the navigation refers to the present page, and do something different for all other pages.
* In my case, "as elegant or as clunky as you like" might be more accurate, because I only speak three words of php. But this is intended to be encouraging, because it shows you just how simple the process it :)