Template based web sites allow you to produce dynamic web content and give your visitors the appearance that each page on your site is different. In this article James shows us how to implement a template based web site using two methods: a MySQL database and a flat file approach.
This function does exactly the same as the last, but instead loads the template from a /templates/ directory (with a no file extension).
Now that we have our function for reading a template, we can go about using one. Firstly, however, insert the following 2 templates into the database table, or into two files, depending on the method you wish to use:
Template Name: ResultsPage
<html>
<head>
<title>$pagetitle</title>
</head>
<body>
<h1>$pagetitle</h1>
<p>Below are the results of the search for '$searchquery'</p>