[TYPO3-mvc] How to access typoscript properties in viewHelpers?
Franz Koch
typo3.RemoveForMessage at elements-net.de
Thu May 6 11:56:49 CEST 2010
Hey,
> I guess that the answer to my question is going to be super easy, but I
> cannot figure it on my own for 1h now.
> In controllers we can use $this->settings and we can get the properties
> from our typoscript setup file.
>
> How to use Typoscript in my viewHelpers?
> plugin.my_plugin {
> settings {
> itemsPerPage = 20
> }
> }
>
> I want to use this itemsPerPage in my controller and viewHelper. Any way
> to do that?
why don't you pass it to your viewHelper as argument/parameter?
<xy:pagination itemsPerPage="{settings.itemsPerPage}"
itemsTotal="{f:count(subject:myObjects)}"/>
But if you prefer to access your settings directly in your viewHelper,
try this:
$settings = $this->templateVariableContainer->get('settings');
I'm not sure if there is any easier/better solution - but it's working.
--
kind regards,
Franz Koch
More information about the TYPO3-project-typo3v4mvc
mailing list