Can't load template in plugin?

No, registering just means that Kirby knows where to find the template (it would otherwise look for it in site/templates, not in your plugin folder).

You would still have to use tpl::load() to load the template, because this is not done automatically. How would Kirby know what template to load for a page that doesn’t exist? By default, the name of the content file determines the template that renders the content. In the absence of this, you have to tell Kirby to load the template.

There are a few downsides to the tpl::load() method, you would have to pass the variables on to the template and down to the snippets used within the template.

I’d probably still rather just load the template then to create a new page - and no, if you load the template, you don’t need a content folder.

See this example: Render a template without the corresponding content

1 Like