繁体   English   中英

TYPO3问题与Typoscript和访问$ this->设置

[英]TYPO3 issue with Typoscript and accessing $this->settings

我正在使用TYPO3版本7.6.14,我已经为客户端创建了一个扩展,它有四个控制器,四个插件,总体上非常大。 无论如何,我现在需要为动态或用户选择的“页面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”下的Default Root模板中输入的,当浏览Typoscript对象时(在管理中)我可以看到设置设置就好了。 所以我认为我没有无效的TypoScript。

如果您有四个插件,则必须为每个插件设置此Typoscript设置。 如果正确包含上面的Typoscript,则只能通过插件“basket”访问“settings”。

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

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

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM