If you're wondering what templates are, first go read the first few paragraphs of
Sascha Schumann's excellent article Templates - why and how to use them in PHP3.
In general, templates let you completely separate your PHP code from the HTML,
which makes the HTML graphic designers very happy and keeps them from messing
up your precious programming.
It's Not FastTemplates
So, do we really need another article on PHPBuilder about using templates?
Well, yes, because there is more than one way to do templates with PHP. Sascha's
article talks about using FastTemplates, but the PHP Base Library
("PHPLIB") has its own implementation of templates.
So how are they different? FastTemplates was originally a Perl library that was
ported to PHP. FastTemplates works well for Perl programs, but it's not ideal for
PHP. Kristian Koehntopp wrote PHPLIB Template from the ground up as a pure PHP
library to better take advantage of the capabilities of PHP. One advantage to
Kristian's design is that it parses templates with preg_replace(), which is said
to be faster than FastTemplate's reliance on ereg_replace(). Another advantage of
PHPLIB Template is it allows dynamic blocks to be nested, unlike FastTemplates.
Both libraries do have a very similar set of features and capabilities, but if
you are already using FastTemplates and you want to learn to use PHPLIB Template,
you should start by trying to forget everything you know about using FastTemplates.
Their features may be similar, but PHPLIB Template does everything just a little
differently than FastTemplates.