[TYPO3-mvc] Fluid link ViewHelper - Dynamic array indexes

Christian Kuhn lolli at schwarzbu.ch
Wed May 11 21:57:47 CEST 2011


On 05/11/2011 09:31 PM, Thomas Allmer wrote:
> On 11.05.2011 17:10, Christian Kuhn wrote:
>> I need to create a link that looks like this:
>>
>> index.php?id=23&tx_myext_pi1[42]=somevalue
>>
>> The '42' is not static, but an object id, thus dynamically generated.
>> [...]
>
> if possible you could just prepare the array in the controller
>
> $this->view->assign('myParams', array('tx_myext_pi1' => array($id =>
> 'somevalue')) );
>
> <f:link.page pageUid="{conf.targetPid}"
> additionalParams="{myParams}">page link</f:link.page>

This seems to be the only possible solution at the moment. For now, I'll 
either circumvent this or I'll create two additional viewHelpers 
(uri.page and link.page) who can be feeded with such an array and will 
array_merge with other additionalParams. This is a ugly workaround:
- It does not solve the real problem
- It is not generic
- It bloats my php with stuff it shouldn't handle

Imho it makes sense to somehow enable parsing of the 'array-keys' as 
well, but looking at the parser class this does not seem to be a trivial 
task (at least for me).

And it is useful: Just think of a form with several elements and input 
fields. With POST, this is no problem, you create something like this is 
a <f:for> loop:
<f:input ... name="tx_myext_pi1[articles][{currentItem.uid}][amount]" 
value="{currentItem.amount}" />
Now you want to have the same as GET link for a specific item using the 
link or uri page viewhelper -> currently impossible.

Regards
Christian


More information about the TYPO3-project-typo3v4mvc mailing list