[TYPO3-mvc] Applying Fluid Viewhelpers using an additional syntax

Sebastian Kurfürst sebastian at typo3.org
Wed Dec 16 11:38:19 CET 2009


Hey,

> {object.text
>     |f:format.crop(maxCharacters: 100)
>     |f:format.nl2br
>     |f:format.html
>     |f:format.printf(arguments: {a: 1, b: 2})
> }
This is not possible, but instead the following syntax works:
{object.text
    ->f:format.crop(maxCharacters: 100)
    ->f:format.nl2br()
    ->f:format.html()
    ->f:format.printf(arguments: {a: 1, b: 2})
}

So, we use -> instead of |, and you _have_ to use brackets after the
ViewHelper name (else the parser cannot disambigurate the different cases).

We have had a long discussion on the ML to use -> instead of | when we
implemented this :-)

> instead of this:
> 
> <f:format.printf arguments="{a: 1, b: 2}">
>     <f:format.html>
>         <f:format.nl2br>
>             <f:format.crop maxCharacters="100">
>                 {object.value}
>             </f:format.crop>
>         </f:format.nl2br>
>     </f:format.html>
> </f:format.printf>
Yep, that was exactly the use-case for it ;)

Greets,
Sebastian


More information about the TYPO3-project-typo3v4mvc mailing list