Ghanshyam Gohel
Ghanshyam Gohel

Reputation: 1274

Typoscript use constant in include_typoscript

Can we use constant variable in include_typoscript

In my constants.txt file

filepaths{
    # cat=FLUIDPAGES/settings; type=text; label=Pfad zu den Templates
    defaultTemplateRootPath = typo3conf/ext/defaulttemplate/
}

In my setup.txt file

Include Page Template
<INCLUDE_TYPOSCRIPT: source="FILE: {$filepaths.defaultTemplateRootPath}fluid.txt">

I just need to use {$filepaths.defaultTemplateRootPath} in my setup file for include typoscript file, If yes it's very helpful for me and I could add multiple themes/templates in multi - Domain site.

Upvotes: 6

Views: 2245

Answers (1)

hildende
hildende

Reputation: 847

According to https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ApiOverview/TypoScriptSyntax/Syntax/Includes.html you can't use constants in the INCLUDE_TYPOSCRIPT part:

It is processed BEFORE any parsing of TypoScript

But you could use the following method in your localconf.php

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScript('myKey', 'setup', '<INCLUDE_TYPOSCRIPT: source="FILE:' . $filePath . 'fluid.txt">');

Upvotes: 3

Related Questions