[TYPO3-mvc] Interresting problem with 'Duplicate variable declariations!'
Claus Due
claus at wildside.dk
Thu Nov 1 10:11:50 CET 2012
Hi Toke,
On Nov 1, 2012, at 10:03 AM, Toke Herkild <th at t3cms.dk> wrote:
> <f:for each="models" as="model">
> <ul>
> <f:for each="{model.foo}" as="foo" >
> <li>{foo}</li>
> </f:for>
> </ul>
> </f:for>
Is this your entire template? I assume no, since the above would not work (models must be {models} or "expected array, got string" will happen).
If it is not your full template then there might be other things that are not incuded here, such as the iteration argument. If you have used the iteration argument and have used the same iteration variable name in both loops, the error will happen ;)
If your template must use the same variable names you will have better luck by splitting your rendering up into multiple sections that you don't pass {_all} arguments to but rather limit which arguments you send along. Using sections/partials will clean the variable scope on each rendering if you use them as described.
PS: A nested foreach is completely valid.
Cheers,
Claus
More information about the TYPO3-project-typo3v4mvc
mailing list