1. Technology
You can opt-out at any time. Please refer to our privacy policy for contact information.

How To Template Your Site


Woman working at home
Eternity in an Instant/Photodisc/Getty Images
When every page of your website follows the same design theme, it is often easiest to create a template for the site. The specific pages of the site only hold their content and not their design. This makes design changes easy, as they take place on all the pages at once, and there is no need to individually update specific pages.
Difficulty: Easy
Time Required: 5 minutes

Here's How:

  1. The first thing you need to do is create a file called header.php. In this file you will hold all of your page design that comes before your content. Here is an example:

    <head><title>My Site</title></head>
    <h2>My Site Title</h2><p>
    My Site menu goes here........... Choice 1 | Choice 2 | Choice 3
  2. Next we need to make a file called footer.php. This file will contain all of the site design information that goes below the content. Here is an example:

    <small>Copyright 2008 My Site</small><br>
  3. Finally you need to create the content pages for your site. In this file you will:

    1. Call the header file
    2. Put in the page specific content
    3. Call the footer file

    Here is an example of how:

    <?php include 'header.php'; ?>
    <b>Sub-Page Title</b><p>
    Here is the specific content of this page....<br>
    <?php include 'footer.php'; ?>


  1. Remember to save all your files with the .php extension.
  2. 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!
  3. Couple this with the use of a style sheet to change style within the page exclusive content easily as well.
Related Video
Basic PHP Syntax
How to Create a PHP Calendar
  1. About.com
  2. Technology
  3. PHP / MySQL
  4. Step By Steps
  5. How to Template Your Site in Five Minutes

©2014 About.com. All rights reserved.