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.
Time Required: 5 minutes
- 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:
<h2>My Site Title</h2><p>
My Site menu goes here........... Choice 1 | Choice 2 | Choice 3
- 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>
- Finally you need to create the content pages for your site. In this file you will:
- Call the header file
- Put in the page specific content
- Call the footer file
Here is an example of how:
<?php include 'header.php'; ?>
Here is the specific content of this page....<br>
<?php include 'footer.php'; ?>
- 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 this with the use of a style sheet to change style within the page exclusive content easily as well.