My solution is a little more complex, but in the end a lot cleaner and easier.
I have a static class called UI that I create per site (it has some resuable components, so it can inherit a base class if need be). This class has several methods to add things like scripts/css/etc. But these can be called from specific scripts to add to the common header. It could be changed to set/modify specific meta tags.
For example;
home.php
PHP Code:
UI::addStylesheet('home');
header.php
PHP Code:
// ... some basic html here ...
foreach (UI::getStylesheets() as $css) {
echo '<link href="'.$css.'.css" rel="stylesheet" type="text/css" />';
}
// ... more basic html ...
This only works if your pages are executed before the header code. If you properly seperate model/views then you can add the stylesheet in the model, but that would be defeating the purpose of seperating business and presentation logic...