{extends 'layout'} makes a page use a layout as its frame. It is not a tag that runs while the page renders: it is resolved in the text while the page is assembled, after the PHP and before anything renders, and taken out. The layout then replaces the frame the page would otherwise get - the _inits.pad and _exits.pad of its directories, and the _common wrapper.

The layout is a template named from the application root, like a {page}; keeping layouts in a directory that starts with an underscore (_layouts/) keeps them from being pages of their own. What the page holds outside its {block} pairs goes where the layout writes @page@ - in front of the layout when it has none. The page's top-level blocks override the layout's blocks of the same name, and {parent} inside one of them brings back the content it overrides. A layout may extend a layout of its own; the chain is followed up to the outermost.

The tag must stand directly in the page's own template, outside any other tag; one found anywhere else - in a snippet, a custom tag, inside an {if} - is an error under the strict check. Under the strict check a block of an extending page that overrides nothing is reported as well. {meta layout='...'} does the same as {extends}.

Because the frame is replaced, a page that extends a layout and is opened on its own shows the layout and nothing of the application's wrapper. Inside a {page}, as in the examples here, the included page is assembled the same way and brings its layout along.