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.
<code>
$template->setTemplate('This is <?php echo $name ?>');
</code>
at line 46
public
setTemplateFile(string $filePath)
Set a file as a template.
The file can be any regular PHP file.
<code>
$template->setTemplateFile(dirname(__FILE__) . '/template/foo.php');
</code>
at line 65
public string
render(array $vars = array())
Render the template using the variable provided as arguments.
<code>
$template = new PropelTemplate();
$template->setTemplate('This is <?php echo $name ?>');
echo $template->render(array('name' => 'Mike'));
// This is Mike
</code>