How to Template Your Site

Template your website headers and footers for easy application

Woman working at home
Eternity in an Instant/Photodisc/Getty Images

When each page of your website follows the same design theme, it is easy to create a template for the site using HTML and PHP. The specific pages of the site hold only their content and not their design. This makes design changes easy because changes take place on all the pages of the website at once, and there is no need to individually update specific pages when the design changes.

Creating a Site Template

The first thing you need to do is create a file called header.php. This file holds all the page design elements that come before the content. Here is an example:

My Site

My Site Title

My Site menu goes here........... Choice 1 | Choice 2 | Choice 3

Next, make a file called footer.php. This file contains all the site design information that goes beneath the content. Here is an example:

Copyright 2008 My Site

Finally, create the content pages for your site. In this file you: 

  • Call the header file (header.php)
  • Put in the page-specific content
  • Call the footer file (footer.php)

Here is an example of how to do this:

Sub-Page Title

Here is the specific content of this page....


  • Remember to save all your files with the .php extension.
  • You can have more than a header and a footer. If needed, create other files to include in the middle and call them the same way.
  • Couple your templates with the use of a style sheet to change style within the page-exclusive content.
mla apa chicago
Your Citation
Bradley, Angela. "How to Template Your Site." ThoughtCo, Aug. 26, 2020, Bradley, Angela. (2020, August 26). How to Template Your Site. Retrieved from Bradley, Angela. "How to Template Your Site." ThoughtCo. (accessed January 22, 2021).