[TYPO3-50-general] RFC: Improved Shorthand Syntax
Bastian Waidelich
bastian at typo3.org
Tue Oct 20 11:21:35 CEST 2009
Sebastian Kurfürst wrote:
Hi Sebastian,
> There is just one thing I am not really sure about: Should we use -> or
> | for chaining?
Mh, that would be
{post.title | f:format.crop(maxChars: 30) | f:format.nl2br()}
instead of
{post.title->f:format.crop(maxChars: 30)->f:format.nl2br()}
right?
What I prefer with the latter syntax is, that the order is clearer (crop
title and _then_ convert newlines to breaks)
> in PHP, "->" does something totally
> different (calling an method on an object)...
nl2br($text) vs text->f:format.nl2br()
It's not so different after all (though it technically it is of course).
> So, I am still undecided if | or -> is better. Some comments? :-)
Or maybe something completely different? ;)
Actually the Fluid "modifiers" seem to have a similar gain as TypoScript
2.0 processors:
10 = Text
10.value = "10"
10.value << 1.multiply(1.5)
so what about:
{post.title << f:format.crop(maxChars: 30) << f:format.nl2br()}
..I don't know
> PS: In the meantime I implemented the syntax, the patch is attached on
> the bugtracker.
Wow, that was quick. Big up!
Bastian
More information about the TYPO3-project-5_0-general
mailing list