In this tutorial I will show you the basics of a template engine.
Template engines are brilliant for separating content from design from code.
This allows you to keep the same content format and just change the template and voila your content is in a new template.
For the purpose of this tutorial I'm not going to use a proper template but just a simple tabled layout, below is the template I've used:
From the code above you may notice {MENU} and {CONTENT}. These are references so the engine will know where it needs to place your menu and content.
Save this as "layout.tpl".
Now we have our template, create a new php file and inside place the following code:
Save this as "menu.tpl".
This will serve as your menu that will be placed where it says {MENU} in your template.
Now we need to create content for your homepage and for the about us page.
Heres what I've got.
<h1>Welcome...</h1>
This is my homepage. Some content could go here describing my site.<br /><br />
Hope you like it!
Save the content for your homepage as "home.tpl"
Now for the about us.
<h1>About Us</h1>
This is the about us page.<br />
Information about you or your site could go here!<br /><br />
Hope you like it!
Save the about us page as "about.tpl".
On the next page we will cover the juicy bits of php that make the template engine tick.