Inherit templates
Contao template inheritance allows overwriting only certain sections of a template (blocks).
Adjust blocks
Many templates already structure their contents by wrapping it with $this->block('name-of-the-block') and
$this->endblock() statements. Only contents wrapped in such blocks can be adjusted.
First, the base template must be declared with $this->extend('name-of-the-template'). Then you can provide new block
content by wrapping it in $this->block('name-of-the-block') and $this->endblock() statements like in the original
template.
The original block content is available via $this->parent().
Examples
The fe_page.html template contains multiple blocks (such as head, meta, body, footer). If we only want to add
another meta tag, we could write the following:
If you want to customize the TinyMCE editor in your Contao instance, you should only adjust the respective blocks in its
initialisation template. You can look at the original be_tinyMCE.html5 template in order to figure out which blocks
are available.
The following adjustment for example would enable the “paste as text” functionality of TinyMCE, i.e. formatting will be removed from any pasted text.