ext_conf_template - 如何在root.ts中使用设置

时间:2018-03-27 07:33:45

标签: typo3

我开发了TYPO3扩展。我有我的设置文件ext_conf_templates。如何在typoscript,root.ts中使用此设置?

# cat=Template_einstellung/101/0104; type=options[nein=,ja=noborder]; label=remove bottom border (only with transparent use)
template.border =

1 个答案:

答案 0 :(得分:2)

ext_localconf.php添加以下代码。

$conf = unserialize($GLOBALS['TYPO3_CONF_VARS']['EXT']['extConf'][$_EXTKEY]);
$border = $conf['template.']['border'];
\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addTypoScriptConstants("
plugin.tx_yourextensionkey.template.border = $border
");

现在,在你的typoscript设置中的任何地方你都可以使用{$ plugin.tx_yourextensionkey.template.border}访问你的边界变量。您可以根据需要为此变量命名,但最佳做法是使用插件和扩展名称前缀使其在安装过程中保持唯一。

以上适用于TYPO3 CMS版本8.7。我认为这是一直到版本6.2的相同例程,但我不是100%肯定。

您可以验证这是否适用于Template后端模块。在主选择框中选择TypoScript Object Browser。确保浏览器选择框显示Constants。现在你应该能够找到你的新变量了。

enter image description here