Views
A page's view selects its template, router, controller and fields.
Resolution
A page's template comes from its view (default default). site/ is checked before phlat/, and the folder form before the flat file:
site/views/{view}/index.latte ← checked first
site/views/{view}.latte
phlat/views/{view}/index.latte
phlat/views/{view}.latte
If nothing resolves, a NotFoundException is thrown.
The view also selects the router, controller and field declarations in the same folder: router.php, controller.php and index.json.
Template variables
Every view receives $page, plus whatever the global and view controllers return. $app is not available unless a controller passes it.
Layouts
Share an outer shell with {layout} and {block}:
site/views/post/index.latte
{layout 'site/root.latte'}
{block body}
<article>
<h1>{$page->title}</h1>
<div class="prose">{$page->body|render}</div>
</article>
{/block}
The layout declares the blocks:
site/views/site/index.latte
<!DOCTYPE html>
<html>
<head>
<title>{$page->title}</title>
<link rel="stylesheet" href="{$styles}">
</head>
<body>
{block body}{/block}
</body>
</html>
For syntax, filters and functions, see Latte Templates.