For a fairly simple site, can I simply have something like this: <head> <?php include("head.php"); ?> </head> Code (markup): My reasoning is so that I can simple update 'head.php' and have it apply to all pages on my site. What are the disadvantages of this? Thank you!!
That will work so long as there are no head tags in the head.php file. But it's better to keep the markup together, as shown in this tutorial: http://www.tizag.com/phpT/include.php Taken to the extreme, this is what your index.php file would look like: <?php include("head.php"); include("content.php"); include("footer.php"); ?> Code (markup):
The only disadvantage, is that any execution at runtime will add a load to the server and thus the loadtime for the webpage. Now, realistically speaking your going to need a hell of a lot of traffic for a single include to make a noticable difference but it is wrong to say there are no disadvantages.
For a fairly simple site, you would have a fairly simple <head> block, so why use the include? Disadvantages. . . you can't use different stylesheets from page to page. It is an odd approach and having someone else troubleshoot the page would leave him/her scratching their head saying "why would you do that".