Well of Stars

Dividing your pages

When you have created your layout - or layouts - you need to divide each one into three parts. Basically, you want to separate out the specific content of individual pages from their surroundings - the coding for the layout and anything else you want to appear on all your pages.

The Header

Save everything above the page content in a file called 'header.php' - this will usually include your html header (containing the title, meta tags, and the link to your css file), your title image, your navigation - everything up to and including the opening tag that defines your page content area. If it's a div layout, your header.php might end with something like <div id="content">; if it's a tables layout, it might be <td id="content">

The Footer

Save everything below the specific page content in a file called 'footer.php' - this could include just the closing tags for your content div or table, and the closing body and html tags. If you have something you want to appear at the bottom of every page, such as a disclaimer, this could be included in footer.php. If you have a tables layout with navigation on the right, this file would include your navigation.

The Content

What you have left should be the content - text and images - of your individual pages. Name these as you would normally name the pages on your site, except you should give each one the extension .php instead of .html. So you'll have index.php, updates.php, gallery.php... or whatever pages your site contains.


View sample header file
View sample footer file
View sample content page - don't worry about the bits of php on this page, they'll be explained in the next section ;)

On to...
PHP includes