Monthly Archives: August 2016

Typo3 and conditional TypoScript includes

Since a long time it’s possible to split your TypoScripts into external files and include them from your template via
<INCLUDE_TYPOSCRIPT: source="FILE: fileadmin/fileToInclude.ts">
So it’s very easy to use your favorite editor and, more important, organize the TypoScript-Files into smaller, reusable chunks.

My common setup is something like that:
Template-Code:
<INCLUDE_TYPOSCRIPT: source="FILE: fileadmin/tpl/include.ts">

fileadmin/tpl/include.ts:
<INCLUDE_TYPOSCRIPT: source="FILE:fileadmin/tpl/ts/site.ts">
<INCLUDE_TYPOSCRIPT: source="FILE:fileadmin/tpl/ts/defaults.ts">
<INCLUDE_TYPOSCRIPT: source="FILE:fileadmin/tpl/ts/header.ts">
<INCLUDE_TYPOSCRIPT: source="FILE:fileadmin/tpl/ts/menu.ts">
<INCLUDE_TYPOSCRIPT: source="FILE:fileadmin/tpl/ts/plugin_news.ts">
<INCLUDE_TYPOSCRIPT: source="FILE:fileadmin/tpl/ts/plugin_facebook.ts">

But there is one large downside. Every include adds an [GLOBAL] at the end of file. So it’s not possible to include files based on a multi level condition. For example if you like to develop a new design and want to test it on a test domain. For more information see https://forge.typo3.org/issues/16525

But since Typo3 7.6 there is something which can help. Continue reading »