Before starting with templates you have to load the template extension using composer:

    "require": {
        "falkm/hubert-template": "1.*"

Afterwards you create a config/ file:

return array(
    "factories" => array(
        "template" => array(hubert\extension\template\factory::class, 'get')
    "config" => array(
        "template" => array(
            "path" => dirname(__dir__).'/src/templates',
            "fileExtension" => "phtml",
            "extensions" => array(

In the controller section we learned that the home route calls the indexAction of the indexController. It returns $this->responseTemplate("index/index", ["name" => "Hubert"]). That means that the template src/templates/index/index.phtml is loaded and the variable $name is passed to it.

<?php $this->layout('layout') ?>
Name: <?= $name ?>

Now we can output the variable and load the layout named "layout". It is also placed inside the template directory at src/templates/layout.phtml

            <li><a href="<?= $this->url('home') ?>">Home</a></li>
            <li><a href="<?= $this->url('mvc',['controller' => 'index', 'action' => 'redirect']) ?>">Redirect Home</a></li>


In the layout the content of the index template is emitted as section. More information about using Plates temlpates can be found at

Template extensions

In the configuration a url extension is loaded. It provides three functions inside of the templates: