Inherit template

This article is machine translated.

The structure of a template can vary from simple to complex content. Most of the templates are divided into areas with the above-mentioned block functions (block() and endblock()). You can access these areas via template inheritance. This makes individual template changes more transparent.

The template fe_page.htmlis divided into several blocks (including head, meta, body, , , footeretc.). We only want to add an additional meta specification.

For this we create a new template fe_page_meta.html5with the following content:

<?php $this->extend('fe_page'); ?>

<?php $this->block('meta'); ?>
  <?php $this->parent(); ?>

  <meta name="author" content="John Doe">
<?php $this->endblock(); ?>

The function extend()defines the parent template and the function parent()takes the original (block) content. If we use this template, all pages will be delivered with the additional meta information.