class TemplateHelper extends Plugin

Allows the generation of template partials. Unfortunately, Phalcon's standard views seem to only render once per request, without some crazy hackery. This allows you to generate multiple instances of Volt templates.

It may be replaced with Twig compiler in the future, so you've been warned.

include and extends are a bit wonky in this set up, so the string './' in either of those tags will be replaced with the absolute path to the current template. For example:

{% extends './base.volt' %}

Properties

$compiledPath
$templatesDir
$compiler

Methods

__construct(string $templatesDir)

Constructor

render(string $templatePath, array $data)

Render template

Details

at line line 33
__construct(string $templatesDir)

Constructor

Parameters

string $templatesDir Template root path

at line line 98
render(string $templatePath, array $data)

Render template

Parameters

string $templatePath relative path from root
array $data Data to be passed to template