Skip to content

Kirby 4.5.0

Templates

Add your own template engine

/site/plugins/template-engine/index.php
class CustomTemplate extends Kirby\Cms\Template {

}

Kirby::plugin('my/template', [
    'components' => [
        'template' => function (Kirby $kirby, string $name, string $contentType = null) {
            return new CustomTemplate($name, $contentType);
        }
    ]
]);

Make sure to check out all existing plugins for template engines.

Parameters

Name Type Default Description
$kirby * Kirby\Cms\App
$name * string Template name
$type string 'html' Extension type
$defaultType string 'html' Default extension type

Return type

Kirby\Template\Template