TypoScript
¶
By convention all TypoScript, that can be included manually, should
be stored in the folder EXT:
.
Note
It is possible, though usually not recommended, to provide TypoScript that is always included. See ext_typoscript_constants.typoscript and ext_typoscript_setup.typoscript.
TypoScript constants should be stored in a file called constants.
and TypoScript setup in a file called setup.
.
$ tree packages/my_extension/Configuration/TypoScript/
├── constants.typoscript
└── setup.typoscript
These two files will be included via
Extension
in the file
Configuration/
:
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile(
'my_extension',
'Configuration/TypoScript/',
'Examples TypoScript'
);
If there should be more then one set of TypoScript templates that may be included, you can use store them in sub folders.
If your TypoScript is complex and you need to break it up into several files
you should use the ending .typoscript
for these files.
$ tree packages/my_extension/Configuration/TypoScript/
├── Example1
│ ├── constants.typoscript
│ └── setup.typoscript
├── SpecialFeature2
│ ├── Setup
│ │ ├── SomeIncludes.typoscript
│ │ └── OtherIncludes.typoscript
│ ├── constants.typoscript
│ └── setup.typoscript
├── constants.typoscript
└── setup.typoscript
In this case Extension
needs to be called
for each folder that should be available in the TypoScript template record:
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile(
'my_extension',
'Configuration/TypoScript/',
'My Extension - Main TypoScript'
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile(
'my_extension',
'Configuration/TypoScript/Example1/',
'My Extension - Additional example 1'
);
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile(
'my_extension',
'Configuration/TypoScript/SpecialFeature2/',
'My Extension - Some special feature'
);
Note
For historic reasons you might still see filenames like setup.
and
setup.
. For backward compatibility reasons these are still
included by Extension
. However all
new TypoScript files should have the file ending .typoscript
.