Mal's Web Madness

A basic tutorial on building websites with PHP


Introduction
The Web Page Files
Let's Start
Making It Work
Making More Pages
Making Links
Making Things Sexy

Strategic Planning

Big words used in business to describe a process of defining what your goals are and working back through the processes that will allow you to achieve your goals.

This is how I taught myself what I hope you will learn from this. I had a basic web page and I wanted to learn how to create it using some HTML templates, so that I could then create any number of similar pages using those same templates.

I didn't want to rewrite the HTML on the templates for every page. Although that is easy to do using copy/paste or file/save_as, it is not good for site maintenance because then every page has to be changed when changes are made.

Have a look at the page I wanted (rough draft).

Because Best Western are likely to change their corporate image and hence page layout at any time, I need to be able to change all that easily without changing the content on the site.

There are four clearly defined regions on the page:

  • The navigation bar
  • The page header
  • The page content
  • The page footer

Having written the page I then literally cut it into four pieces:

  • nav.inc
  • header.inc
  • index.php
  • footer.inc

The .inc files are simply text files with the HTML on them.

The .php file is simply the content of the page with a tiny bit of PHP code (easily learnt) at the top and bottom:

And that's all there is to it!

So let's do it together: continue!