TypoScript: include .typoscript file for certain typeNum

raw

typo3-v11.typoscript

1
2
3
4
5
# @import in TYPO3 v11 does not support conditions
# we cannot use request.getQueryParams() since that does not work with PageTypeSuffix
# https://docs.typo3.org/m/typo3/reference-coreapi/11.5/en-us/Configuration/TypoScriptSyntax/Syntax/Includes.html
 
<INCLUDE_TYPOSCRIPT: source="FILE:EXT:example/Configuration/TypoScript/json.typoscript" condition="[getTSFE() && getTSFE().type == 2]">
raw

typo3-v12.typoscript

1
2
3
4
5
6
7
# @import in TYPO3 v12 supports conditions
# https://docs.typo3.org/m/typo3/reference-coreapi/12.4/en-us/Configuration/TypoScript/Syntax/FileImports/Index.html
# https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/12.0/Feature-97816-TypoScriptSyntaxImprovements.html#import-in-conditions
 
[getTSFE() && getTSFE().type == 2]
    @import 'EXT:example/Configuration/TypoScript/json.typoscript'
[end]
Christian Weiske Christian Weiske
owner

History