Hey there.
"{returnValue.a}" would be the correct call, since the view helper Anja suggested introduces that exact variable name.
You would need to call it like this
<namespace:test>
<h1>Test: {returnValue.a}</h1>
{returnValue -> f:debug()}
</namespace:test>
That's basically what the forViewHelper does for each iteration, it introduces a new variable which is named according to the string given as "as" argument of the forViewHelper. You skipped that "as" argument and used always "returnValue".
Another idea would be to create that "return $array" view helper you posted in your first mail and use this one inside an "alias" view helper
<f:alias map="{returnValue: '{namespace:test()}'}">
<h1>Test: {returnValue.a}</h1>
{returnValue -> f:debug()}
</f:alias>
Regards,
Stephan Schuler
Web-Entwickler | netlogix Media
Telefon: +49 (911) 539909 - 0
E-Mail: ***@netlogix.de
Web: media.netlogix.de
netlogix GmbH & Co. KG
IT-Services | IT-Training | Media
Neuwieder Straße 10 | 90411 Nürnberg
Telefon: +49 (911) 539909 - 0 | Fax: +49 (911) 539909 - 99
E-Mail: ***@netlogix.de | Web: http://www.netlogix.de
netlogix GmbH & Co. KG ist eingetragen am Amtsgericht Nürnberg (HRA 13338)
Persönlich haftende Gesellschafterin: netlogix Verwaltungs GmbH (HRB 20634)
Umsatzsteuer-Identifikationsnummer: DE 233472254
Geschäftsführer: Stefan Buchta, Matthias Schmidt
- -----Ursprüngliche Nachricht-----
Von: typo3-english-***@lists.typo3.org [mailto:typo3-english-***@lists.typo3.org] Im Auftrag von Hagen Gebauer
Gesendet: Freitag, 20. Februar 2015 09:41
An: typo3-***@lists.typo3.org
Betreff: [TYPO3-english] Re: Extbase/Fluid extension: viewhelper to return associative array (T3 6.2.4)
Hi Anja,
thanks a lot for your reply. But somehow it doesn't work although there isn't a parsing error at least :) calling {returnArray.a} returns an empty string {namespace:returnArray.a} or {namespace:test.returnArray.a} instead are not being parsed but displayed as is.
(the class is called TestViewHelper that's why I tried to call namespace:test...)
Here is the full class:
class TestViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper {
/**
*
* @return array
*/
public function render() {
$returnArray = array('a' => 17, 'b' => 42);
$this->templateVariableContainer->add('returnArray', $returnArray);
$output = $this->renderChildren();
$this->templateVariableContainer->remove('returnArray');
return $output;
}
}
Cheers,
Hagen.
_______________________________________________
TYPO3-english mailing list
TYPO3-***@lists.typo3.org
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english