Using Inheritance in TypoScript Templates

TypoScript code is inherited within a TYPO3 website. Most commands can be stored in the Root Template on the topmost level.


The idea came from when an interested party asked us to take a look at his TYPO3 system. He criticized the length of time needed by his programmer for structural changes.

Negative Example

Having taken a look at the TypoScript templates it was quickly evident what was causing these lengthy processing times: The programmer (a TYPO3 newbie) had integrated the root template into the homepage and then copied it to all sub-pages. In principal this works, but as soon as changes need to be made to the TypoScript code then these need to be made to every copied template.

Best Practice

The main part of the TypoScript programming should be included in the so-called root template of the website's homepage.

A root template can be created by adding a new template record to the homepage. This is done by selecting "Create template for a new site" as opposed to "Click here to create an extension template" which are used on sub-pages.

Two options for saving TypoScript code:

1. All commands are saved in a single root template. Depending on the complexity of the website this template can be very extensive.

2. (Our recommendation) The commands are distributed across several templates which are then integrated into the original root template. Distribution can be made for example in accordance with the website parts (navigation, header, footer, content etc).

Using inheritance

The code of a TypoScript template is inherited by all sub-pages. It is therefore not necessary to copy the entire template to sub-sites.

If certain commands from the root template cannot be implemented to a sub-page or need to be implemented differently, then it suffices to simply adapt the required code. It is also possible to integrate the required extension template code (via "Extension Templates") only onto the pages on which the relevant extension features.

When it comes to extension templates it is important that no ticks are added to the "Constants" and "Setup" checkboxes (displayed below "Delete" in the "Options" tab), because otherwise all inherited TypoScript commands will be ignored.