[TYPO3-mvc] Accessing Typoscript values from a fluid template
Alban Cousinié
lists at mind2machine.com
Tue Apr 19 12:00:29 CEST 2011
> Hi Alban,
>
> getting your settings from TS is easy, for example if you have:
>
> plugin.tx_ext_pi1.settings.limit = 10 in your TS Setup, this can be
> retrieved using
>
> $this->settings['limit'] in your controller and viewhelpers (? never
> tried that one).
>
> For Fluid you can use: {settings.limit}
>
> Hope this helps,
>
> Henjo
Thanks Henjo for the reply.
I finally succeeded accessing my Typoscript settings using your advices and
by erasing all my plugin setup TS settings and recreating them. Prior this
operation, my settings were always empty. There should have been a typo
somewhere that had screwed up the parameters forwarding.
Sadly only the section plugin.tx_ext_pi1.settings is accessible from fluid.
I find it too bad to limit the access to only this subset of the extension
parameters while in my opinion the whole plugin.tx_ext_pi1 elements should
be accessible. I'm going to fill a feature request for that.
So here is the result of my tests :
In the fluid template :
{settings.limit} does work
{persistence.storagePid} does NOT work (no access to 'persistence' rootline)
In a controller :
$this->settings['limit'] does work
$this->persistence['storagePid'] does NOT work
In a viewHelper :
$this->settings['limit'] does work
$this->persistence['storagePid'] does NOT work
Accessing persistence.storagePid from the viewhelper requires injecting a
configurationManager object. This is done in the default fluid be.tableList
viewHelper (read the source of this viewhelper if interested). Then the
storagePid of the extension can be obtained using :
$frameworkConfiguration =
$this->configurationManager->getConfiguration(Tx_Extbase_Configuration_Confi
gurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK);
$storagePid = $frameworkConfiguration['persistence']['storagePid'];
And the whole Typoscript of the Typo3 installation can be accessed using :
$frameworkConfiguration =
$this->configurationManager->getConfiguration(Tx_Extbase_Configuration_Confi
gurationManagerInterface:: CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
$storagePid = $frameworkConfiguration['persistence']['storagePid'];
Regards,
Alban
More information about the TYPO3-project-typo3v4mvc
mailing list