-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
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: [email protected]
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: [email protected] | 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: [email protected]
[mailto:[email protected]] Im Auftrag von Hagen Gebauer
Gesendet: Freitag, 20. Februar 2015 09:41
An: [email protected]
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
[email protected]
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english
-----BEGIN PGP SIGNATURE-----
Version: PGP Universal 3.3.2 (Build 15704)
Charset: utf-8
wpUDBQFU53Kmpp0IwsibV8MBCFU+BACbjLLDBi8U9f4b2/uKA1JJER3YHDIKQEyH
jkHNDOAI/W2b1j2uDZR91yq0SwA7sfCcbLVeCvRCB6Z4hlxmLRZE203L0CalvGeW
FCRduZRw6rL9RXRWvUAt2LW1STU1+nZMVTJ8vx+5gGgMdcfRITKT1NwHbXJBND3P
hcAXN5MWgg==
=K6Bv
-----END PGP SIGNATURE-----
_______________________________________________
TYPO3-english mailing list
[email protected]
http://lists.typo3.org/cgi-bin/mailman/listinfo/typo3-english