Typoscript 和访问 $this->settings 的 TYPO3 问题

TYPO3 issue with Typoscript and accessing $this->settings

我使用的是 TYPO3 7.6.14 版,我为客户端创建了一个扩展,它有四个控制器、四个插件,而且总体来说相当大。无论如何,现在我需要为动态或用户选择的 "page id" 添加选项(设置变量),然后用于从一个插件重定向到另一个插件。对于我的问题可能有更好的解决方案,但我正在尝试做类似的事情:

plugin.tx_extname_basket {
    view {
        # cat=plugin.tx_extname_basket/file; type=string; label=Path to template root (FE)
        templateRootPath = EXT:extname/Resources/Private/Templates/
        # cat=plugin.tx_extname_basket/file; type=string; label=Path to template partials (FE)
        partialRootPath = EXT:extname/Resources/Private/Partials/
        # cat=plugin.tx_extname_basket/file; type=string; label=Path to template layouts (FE)
        layoutRootPath = EXT:extname/Resources/Private/Layouts/
    }
    persistence {
        # cat=plugin.tx_extname_basket//a; type=string; label=Default storage PID
        #storagePid =
    }
    settings {
        #  cat=plugin.tx_extname_basket//a; type=int; label=Products Page ID
        productsPage =
    }
}

现在的问题是,即使我 100% 确定 Typoscript 已正确包含到加载扩展的页面中,但变量 $this->settings['productsPage'] 和 FLUID {settings.productsPage} 不起作用。我清除了整个缓存,甚至尝试删除整个 typo3temp 文件夹,但它仍然不起作用。我也试过调试 $this 对象,它说 settings => NULL.

哦,productsPage 是在 "SETUP" 下的默认根模板中输入的,当浏览 Typoscript 对象(在管理中)时,我可以看到设置设置得很好。所以我不认为我有无效的 TypoScript。

如果您有四个插件,则必须为每个插件设置此 Typoscript 设置。如果您上面的 Typoscript 被正确包含,"settings" 将只能由插件 "basket".

访问

另一件事:您 Typoscript 中的注释似乎是 Typoscript 常量而不是 Typoscript 设置。在设置中,您还必须将这些常量传递给插件配置。示例:

plugin.tx_extname_basket {
    settings {
        productsPage = {$plugin.tx_extname_basket.settings.productsPage}
    }
}

您还必须将模板等的其他常量传递给设置。