[TYPO3-mvc] Viewhelper giving back objects
Franz Koch
typo3.RemoveForMessage at elements-net.de
Sat Nov 20 18:13:22 CET 2010
Hey Heiko,
>>> I am trying to make a selection of objects using a viewhelper. I do this
>>> to get the right objects displayed based on some getVars.
>>>
>>> What is the way to have a viewhelper return the objects?
>>
>> yepp - you have to assign them to the templateVariableContainer, then
>> render the children and after that remove your object/variable again
>> from the container. Just have a look at the for-viewHelper of Fluid
>> how to do it.
>
> thanks I will dive in a little further then!
it's almost like in controllers, where you assign variables to the view,
with the only difference that you have to remove them again after you
rendered the viewHelper content.
public function render($what, $as,...) {
//...
$processedContent = ...;
$this->templateVariableContainer->add($as, $processedContent);
$output = $this->renderChildren();
$this->templateVariableContainer->remove($as);
return $output;
}
--
kind regards,
Franz Koch
More information about the TYPO3-project-typo3v4mvc
mailing list