在include_typoscript中使用Typoscript常量

Gha*_*hel 5 typo3 typoscript

我们可以在include_typoscript中使用常量变量吗?

在我的constants.txt文件中

filepaths{
    # cat=FLUIDPAGES/settings; type=text; label=Pfad zu den Templates
    defaultTemplateRootPath = typo3conf/ext/defaulttemplate/
}
Run Code Online (Sandbox Code Playgroud)

在我的setup.txt文件中

Include Page Template
<INCLUDE_TYPOSCRIPT: source="FILE: {$filepaths.defaultTemplateRootPath}fluid.txt">
Run Code Online (Sandbox Code Playgroud)

我只需要在我的安装文件中使用{$ filepaths.defaultTemplateRootPath}来包含typoscript文件,如果是,它对我很有用,我可以在多域网站中添加多个主题/模板.

hil*_*nde 3

根据https://docs.typo3.org/m/typo3/reference-coreapi/master/en-us/ApiOverview/TypoScriptSyntax/Syntax/Includes.html,您不能在 INCLUDE_TYPOSSCRIPT 部分使用常量:

它在解析 TypoScript 之前进行处理

但是你可以在 localconf.php 中使用以下方法

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