Basics

Using the Templating system is pretty simple. Unpack the zip file somewhere, include it in your script, and call the static "process" method:

Template::process(templateName, optional variables, optional return);


The variables array

The variables array contains everything that you want to be accessible as a variable to the templates. There are a few variables in this, however, that have special meaning to the template software itself.


The Template Files

The template files themselves are just regular php files, without a .php extension, though if you wanted the templates to be named templatename.php, you could do so, you'd just have to send the complete filename. To prevent shifty template designers from mucking about with your code, actually the actual processing of a template file is done inside a closure where the only variables that can be accessed are the ones that you provide in the variables array. The template instance itself is always available to the processing template as $t, and provides the following functions that the template will need:


Configuration

Configuring is pretty easy. Wherever the Template.php file is located, the program will look for a templates/ directory which should house the templates that will be directly processed. Inside that should be a globals/ directory, which will house, naturally, the global template files. Examples of these are in the download.

You'll want to set the following things inside the Template.php file itself: