[TYPO3-mvc] creating nodes in FLUID - how to?

Sebastian Kurfürst sebastian at typo3.org
Fri Feb 5 08:22:23 CET 2010


Hi Masi,

> I've been playing a bit with the widget idea and came cross Franz's request to generate children on
> the fly. In the example I have chosen "repeat for" to use a natural language construct different
> from "for each". The main difference between them is that for-each will render it's children, but
> repeat-for will create nodes to be rendered by its parent.
I think this is not really needed.

As I understand your problem, you can use the
"ViewHelperVariableContainer" to pass information between ViewHelpers -
example:

<f:a>
	<f:b></f:b>
</f:a>

If f:a needs some value which is set by b, B does the following inside
its render method:
$this->viewHelperVariableContainer->add('Tx_Fluid_ViewHelpers_BViewHelper',
'myidentifier', 'value');

A can access that value like so:
$this->renderChildren() // We need to render children first so that the
				// viewHelpervariablecontainer is filled
$valueOfMyIdentifier =
$this->viewHelperVariableContainer->get('Tx_Fluid_ViewHelpers_BViewHelper',
'myidentifier');

With this possibility, you can also pass arrays etc.

Greets,
Sebastian


More information about the TYPO3-project-typo3v4mvc mailing list