0

I'm working with Typo3, extbase and fluid. I will get an array (multidimensional associative Array) from a php file into my fluid template and print it out there with a loop. I already have a own ViewHelper but I dont know how to send it to the template. They write something about the "controller" where you can initialize these variables but I don't understand it.

If there is another (simpler) way, please let me know it

Dan
  • 9,391
  • 5
  • 41
  • 73

1 Answers1

0

In your controller action, you can assign variables to your view with

public function listAction() {
    // ...
    $this->view->assign('yourArrayInFluid', $yourArray);
}

But what do you need a viewhelper for? You can traverse through arrays in fluid with the already available viewhelpers, for example:

<f:for each="{yourArrayInFluid}" as="yourValue" key="yourKey">
    <p>{yourValue}</p>
</f:for>

You can nest these viewhelpers, so multidimensional arrays should be no problem they aren't dynamic or too complex.

(As seen in the fluid documentation)

Kana
  • 97
  • 8
  • thank you for your answer. I assigned variables with the assign command. I don't know what was the problem but now it it works fine. – Simonx7 Nov 21 '14 at 09:20