--- layout: default permalink: templates/inheritance/ title: Inheritance --- Inheritance =========== By combining [layouts](/templates/layouts/) and [sections](/templates/sections/), Plates allows you to "build up" your pages using predefined sections. This is best understand using an example: ## Inheritance example The following example illustrates a pretty standard website. Start by creating a site template, which includes your header and footer as well as any predefined content [sections](/templates/sections/). Notice how Plates makes it possible to even set default section content, in the event that a page doesn't define it.
template.php
~~~ php <?=$this->e($title)?>
section('page')?>
~~~ With the template defined, any page can now "implement" this [layout](/templates/layouts/). Notice how each section of content is defined between the `start()` and `end()` functions.
profile.php
~~~ php layout('template', ['title' => 'User Profile']) ?> start('page') ?>

Welcome!

Hello e($name)?>

stop() ?> start('sidebar') ?> stop() ?> ~~~