Reference

Guide

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);
        }
    ]
]);

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

Source code

kirby/config/components.php#L156