[TYPO3-mvc] fluid: adding own variables [discussion]

Christian Zenker christian.zenker at 599media.de
Fri Jul 17 10:51:17 CEST 2009


Am 17.07.2009, 08:10 Uhr, schrieb Sebastian KurfŸürst
<sebastian at typo3.org>:

Hi Sebastian

> So far, we explicitely decided _not_ to add something like a register -  
> i.e. that a ViewHelper has to clean up all variables he has added to the  
> View when the tag closes.

That's why the AddViewHelper should not add the values itself, but ask the
StorageViewHelper to do so.

> What we have, though, is an "f:alias" viewHelper which aliases certain  
> variables or expressions to new names inside its tags.
> <f:alias map="{foo:bar, hu:hi}">
> // here, {foo} and {hu} will be available
> </f:alias>
> // here not.

I don't see how this helps..? Looks more like a tag for cosmetics.

> What about implementing a "toggle" ViewHelper?

This would help in this specific case, but what if someone would like to
   - have three colors,
   - color only the first/last item,
   - highlight special offers,
   - or whatever designers might think of...

Something like

<f:register.conditional condition="{key}%2" then="{'foo':'bar'}"  
else="{'foo':'baz'}">
   ...
</f:register.conditional>

should be following the paradigms of fluid (?) and help in some cases, but  
reaches its limits when it comes to nested conditions. But I'd like to  
have a more general and flexible construction.


In my eyes it's a major drawback of fluid only beeing able to fill tag's  
parameters with existing (or derived) variables.

One more example our designer pointed me to:

Presume, there is an event calender and different locations should be  
highlighted using different css-classes (e.g. for different colors). The  
designer needs nested if-else-constructions (or a SwitchViewHelper ;) ) to  
assign the classes. The above Register_ConditionalViewHelper won't help  
then, but a register would be helpfull to avoid doubled content.


Christian.


More information about the TYPO3-project-typo3v4mvc mailing list