[TYPO3-50-general] different methods in template-engines
bastian at typo3.org
Sun Dec 21 13:02:37 CET 2008
Irene Höppner wrote:
> I just realized that you have to use different methods to assign the
> model to a view in Smarty and in Fluid.
> Smarty: $this->view->assign('posts', $posts);
> Fluid: $this->view->addVariable('posts', $posts);
You're right, I thought about that one too.
Maybe we should use a magic setter here, so you could write
$this->view['posts'] = $posts;
but this might raise a problem, because:
1. magic methods are slow
2. you mix up properties and data of the view
I've seen other MVC frameworks use a collection "ViewData" for this:
$this->viewData['posts'] = $posts;
Or we could just define a unique convention for the method name. I don't
really like "addVariable" here, cause it's basically not a variable
that gets added but a value that is set.. Maybe some native English
speaker can comment on this..
> Merry Christmas to all of you!
Merry Christmas to you too!
More information about the TYPO3-project-5_0-general