Automate your header and footer
Jun 21st, 2008 by Richard
So is domain parking not making you the money it used to and you are thinking about biting the bullet and developing a few of your best domains?
Where to start
You need to build pages, write content, get links and more. There is a lot of work to do. I like to automate as much of it as possible. I like to make a header file, footer file and maybe a navigation file if your navigation is not in your header.
Then I take my template, include my header and footer and stamp out page after page with the content that I have written.
When I am all done, I surely have missed something and now I need to update my navigation menu in my header. Perhaps I made a typo, or missed a link to a page. Do I edit each of the 50 pages that I just built to fix that?
No way, I just make the change to one file - my header file - and the changes are included in all of my 50 pages.
How it works
Building a header and footer file is very easy. All you need is take your web site template, cut out your header code and put it into a separate file (I call mine header.php) and then do the same for your footer (I call mine footer.php).
Once you have done that, you use the php include() function in your template file to dynamically put your header and footer back into your web site pages when they are loaded. This way, you simply make changes to your header.php and footer.php files if you want to change your logo, change your menu, add a new link to the footer etc.
Yes, it’s that easy.
Sample code
Below are links to some sample code demonstrating just how simple it is to dynamically include your header and footer into your web pages. To use the code, just download the .txt files, then upload them to your web space, then rename the files to .php and load the page.php in your web browser.
Sample header
Sample footer
Template page
If you have any problems or questions, please make a comment and I will be happy to help you.
Once you have mastered the header and footer, read my post about how to create dynamic title and meta tags.
Enjoy !
[...] « How to avoid down time Automate your header and footer [...]
[...] basic elements such as a header, footer, navigation and content. By using a well coded template and automating your header and footer and title and meta tags, the only work left for you to do is write [...]