Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 310
Ghanshyam Gohel Avatar asked Jan 30 '14 05:01

Ghanshyam Gohel


1 Answers

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">');
like image 187
hildende Avatar answered Sep 18 '22 07:09

hildende