PHPTemplate

A PHP-based template class inspired by the example at http://www.sitepoint.com- /print- /beyond-template-engine The idea is to simplify the template engine by just using regular old PHP source files as template files.  Since the syntax for advanced templating is not significantly less complicated than regular PHP syntax, we might as well save ourselves some trouble and just use PHP.

Please note that this class will depend on an appropriately set include_path.  This will allow us to transparently have different templates for different sections of the site and fall back to the default if we don’t want to bother.

Ihnerits

LnBlogObject

Summary
A PHP-based template class inspired by the example at http://www.sitepoint.com- /print- /beyond-template-engine The idea is to simplify the template engine by just using regular old PHP source files as template files.
Sets a template variable.
Unsets a previously set template variable.
Determine if a template variable has been set.
Resets a template back to its empty state, clearing all variables and the file.
Process the template and get the output.

Functions

set

function set($var,  
$val = true)

Sets a template variable.

Parameters

varThe name of the variable.
valOptional value for the variable.  Defaults to true.

Returns

The value passed or true.

unsetVar

function unsetVar($var)

Unsets a previously set template variable.

Parameters

varThe name of the variable to unset.

varSet

function varSet($var)

Determine if a template variable has been set.

Parameters

varThe name of a template variable.

Returns

True if var has been set, false otherwise.

reset

function reset($file = "")

Resets a template back to its empty state, clearing all variables and the file.

Parameters

fileAn optional file name for the reset template.

process

function process($return_results = true)

Process the template and get the output.

Parameters

return_resultsOptional boolean that determines whether the output should be returned in a string instead of sent straight to the client.  *Default is true.

Returns

A string containing the output if return_results is true.  Otherwise, it returns true on success and false on failure.

function set($var,  
$val = true)
Sets a template variable.
function unsetVar($var)
Unsets a previously set template variable.
function varSet($var)
Determine if a template variable has been set.
function reset($file = "")
Resets a template back to its empty state, clearing all variables and the file.
function process($return_results = true)
Process the template and get the output.
A base object which is event-aware, i.e.