8

I have a fluid template, from where I call an often used snippet (called "partial"):

Template:

<f:render partial="fbLikeBox" arguments="{settings}"/>

Partial fbLikeBox.html:

<div id="fb-root"></div><script src="http://connect.facebook.net/xxxxxxxx"></script>
<fb:like href="{settings.baseURL}/details/?guide_uid={audioguide.uid}">
</fb:like>

As you can see, I need both values from the {settings} and the {audioguide} array passed to the partial. How can I achieve that?

Mateng
  • 3,607
  • 5
  • 35
  • 61

2 Answers2

34

Starting with TYPO3 4.6, you could just use

<f:render partial="fbLikeBox" arguments="{_all}" />

The {_all} will simple make sure all variables currently available in your template, are available in the partial.

  • Cool solution, however occasionally I get the exception: `The argument "arguments" was registered with type "array", but is of type "object" in view helper`. This might happen when I call _nested partials_. Using below method works fine. – Mateng Jul 03 '13 at 16:17
  • 1
    Also, with `{_all}` you might run into performance issues. If loading time is too long, try to reduce the number of arguments. – Mateng Aug 09 '13 at 12:21
  • This is not an answer to to OP's question. While it might work for the OP, the answer from konsolenfreddy is correct – yunzen Apr 14 '16 at 10:30
28

you can use an array, like:

<f:render partial="fbLikeBox" arguments="{settings : settings, audioguide:audioguide}"/>

They're key : value pairs where the value defines the accessible name in your partial

konsolenfreddy
  • 9,296
  • 23
  • 36