PHP

Simple PHP Templates With PatTemplate

PatTemplate is a template system that gives us the power and flexibility to add templates to our PHP driven sites. In this article Havard gives us details and examples of how to use patTemplate with PHP.

This is where the real action is going on. There's nothing special about the addVar() function. The thing to note is the parseTemplate() function. The last parameter is "a", which stands for "append". This means that instead of just parsing the template all over and rewriting what's been parsed before, we actually append after what's already been parsed.

// Parse and display template $tmpl->displayParsedTemplate("body");

The template "namelist" is a child of the "body" template because it's inside of it. When we call the displayParsedTemplate() function on the parent, all child-templates within it are displayed too.