[TYPO3-mvc] How to access typoscript properties in viewHelpers?
Daniel Dimitrov
danielsd_bg at yahoo.fr
Thu May 6 12:33:00 CEST 2010
Thanks Franz,
This does the job: $settings =
$this->templateVariableContainer->get('settings');
I was trying this $this->viewHelperVariableContainer->get(helper name,
setting);
And I wondered all the time what should I put for a Helper as first param :)
Cheers,
Daniel
"Franz Koch" <typo3.RemoveForMessage at elements-net.de> wrote in message
news:mailman.1.1273140034.10424.typo3-project-typo3v4mvc at lists.typo3.org...
> 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