Skip to content

Kirby 3.5.7.1

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 Kirby instance
$name * string Template name
$type string 'html' Extension type
$defaultType string 'html' Default extension type

Return type

Kirby\Cms\Template