TypoScript

Another item that is usually stored in records is TypoScript. Since TYPO3 CMS 6.2 it's possible to include an entire directory (plus subdirectories) with a single include command. The files in this directory will be sorted (files first, then directories). The easiest way to use this features is to use a naming scheme such as: <nn><description>.ts :

 |-- 01-Configuration.ts
 |-- 10-PageTemplate.ts
 |-- 11-PageMetadata.ts
 |-- 50-MetaData.ts
 |-- 51-MainMenu.ts
 `-- ....

The actual include statements will be added to Configuration/TypoScript/Static/setup.txt..

<INCLUDE_TYPOSCRIPT: source="DIR:EXT:typo3coder/Configuration/TypoScript/Elements" extensions="ts">
<INCLUDE_TYPOSCRIPT: source="DIR:EXT:typo3coder/Configuration/TypoScript/Extensions" extensions="ts">

The TypoScript still needs to be registered by adding to ext_tables.php :

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile(
  $_EXTKEY,
  'Configuration/TypoScript/Static',
  'typo3coder'
);

To load the TypoScript you need to include the static templates, just as with any other extension.

What to store in the extension?

For TypoScript we have to distinguish between configuration that is specific for a particular server (assuming that we have at least a development installation and a live website) and what is common for the website. It could very well be that we need to set the absRefPrefix and that it's different for the development installation compared to the live site. Then we'll store that in a constant in a TypoScript template record. In the .ts files we'll use this constant as usual. In the end we can simply install the same sitepackage extension on both installations and still have the correct setting.

Back to Top