Skip to content

Kirby 3.8.4

$page->intendedTemplate()

Returns the template that should be loaded if it exists.

$page->intendedTemplate(): Kirby\Cms\Template

Return type

Kirby\Cms\Template

Parent class

Kirby\Cms\Page

Details

While $page->template() returns the actually used template, $page->intendedTemplate() returns the name of the content file, i.e.

Assuming you have a content file article.txt, then $page->intendedTemplate()->name() will return article.

This method is therefore particularly useful to fetch or filter pages that don't have a corresponding template in the templates folder.

Examples

Basic usuage

<?php
echo $page->intendedTemplate();
?>

Filtering by intendedTemplate

<?php
$filtered = $page->children()->filterby('intendedTemplate', 'article');
?>

Further Reading