# Control structure - `extends` / `section` A nice feature of most robust templating engine is the ability to inherit from other view. Picea follows a similar train of tought, since it's also possible create a chain of inheritance using `extends` which have definable parts you can declare using `section`. ## Basic `extends` (string $path) You must provide a valid `$path` from which the template will be inherited. **[PICEA]** So, using this code: *path/base/layout.phtml* ```html {% section "head" %} {{ title() }} - AnExampleApp {% section %}
{% section "main" %}{% endsection %}
``` *path/home.phtml* ```html {% extends "path/base/layout" %} {% title "Home page" %} {% section "main" %}

Welcome !

{# @TODO integrate our new blog engine below ! #}
This is our new blog ! We hope you are gonna enjoy your stay on our new platform !
{% endsection %} ``` **[HTML]** Would render as such : ```html Home page - AnExampleApp

Welcome !

This is our new blog ! We hope you are gonna enjoy your stay on our new platform !
``` ### Inherit an already extended view We could use the previous file `path/home` and generate, let's say, the same page, but without a navigation menu. **[PICEA]** So, using this code: *path/home-navless.phtml* ```html {% extends "path/home" %} {% section "header" %}{% endsection %} ``` **[HTML]** Would render as such : ```html Home page - AnExampleApp

Welcome !

This is our new blog ! We hope you are gonna enjoy your stay on our new platform !
``` Notice that the `
` tag is now empty, since we've redeclared it in our navless view.