Class

PropelTemplate

class PropelTemplate

Simple templating system to ease behavior writing

Methods

setTemplate(string $template)

Set a string as a template.

setTemplateFile(string $filePath)

Set a file as a template.

string render(array $vars = array())

Render the template using the variable provided as arguments.

Details

at line 32
public setTemplate(string $template)

Set a string as a template.

The string doesn't need closing php tags.

$template->setTemplate('This is ');

Parameters

string $template the template string

at line 46
public setTemplateFile(string $filePath)

Set a file as a template.

The file can be any regular PHP file.

$template->setTemplateFile(dirname(FILE) . '/template/foo.php');

Parameters

string $filePath The (absolute or relative to the include path) file path

at line 68
public string render(array $vars = array())

Render the template using the variable provided as arguments.

$template = new PropelTemplate(); $template->setTemplate('This is '); echo $template->render(array('name' => 'Mike')); // This is Mike

Parameters

array $vars An associative array of arguments to be rendered

Return Value

string The rendered template

Exceptions

InvalidArgumentException
Exception