【问题标题】:TYPO3 Extbase storagePidTYPO3 Extbase storagePid
【发布时间】:2012-05-28 04:09:15
【问题描述】:

我需要获取实际的“一般记录存储页面 id”。我找到了以下代码片段,但即使在页面上设置了 storagePid,变量也是空的。

$config = $this->configurationManager->getConfiguration(Tx_Extbase_Configuration_ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
var_dump($config['persistence']['storagePid']);

任何帮助将不胜感激

【问题讨论】:

    标签: typo3 extbase


    【解决方案1】:

    我不太确定,你想得到什么。您提供的代码片段可以毫无问题地为您的扩展在常量中设置 storagePid,与来自setup.txt 的代码相同:

    plugin.tx_yourext {
        persistence {
            storagePid = {$plugin.tx_yourext.persistence.storagePid}
        }
    }
    

    如果您在使用提供的 sn-p 获取 storagePid 时遇到问题,也可以修改您的 setup.txt 并确保该值也将传播到 settings 范围:

    plugin.tx_yourext {
        persistence {
            storagePid = {$plugin.tx_yourext.persistence.storagePid}
        }
        settings {
            storagePid = {$plugin.tx_yourext.persistence.storagePid}
        }
    }
    

    然后在您的控制器中,您可以使用更简单的代码来捕获它:

    $myStoragePid = $this->settings['storagePid'];
    

    如果它对您不起作用,这意味着您没有在 Constants 中为 YourExt 设置正确的值和/或没有清除 BE 中的缓存。

    顺便说一句:如果你能更具体一点,我可以发送更好的答案。

    【讨论】:

      猜你喜欢
      • 2013-06-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-08-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多