If you've been involved in web development for a while, then you've probably seen the uprise in popularity of using templates. Templates, at least the way I speak of them, are a way for developers to separate content from their actual programming code. You may have read my article about patTemplate, simple called "Simple PHP Templates With PatTemplate", which I wrote in June. In it, I explained how to use an already existing template engine. This time, I'll be explaining how you can write your very own template class with built-in caching features.
When I first started writing this class, I decided that the templates should use normal PHP as opposed to custom tags -- as the template language. By using normal PHP, we can eliminate the overhead many of the other template engines out there get by using their own template languages and parsers.
In this article I will assume that you have at least a basic understanding of PHP and OOP. Now, let's get down to business and start writing the class...