[TYPO3-mvc] RFC: join view helper

Martin Kutschker masi-no at spam-typo3.org
Sat Jan 9 16:37:22 CET 2010


Hi!

I propose a view helper to join arrays in an easy way.

Shortest possible syntax:

<f:join each="{0: 'apple', 1: 'banana'}" by=" and " />

Typical syntax:

<f:join each="{0: 'apple', 1: 'banana'}" as="fruit" by=" and " >{fruit}</f:join><br>

Long syntax:

<f:join each="{0: 'apple', 1: 'banana'}" as="fruit">
 <f:item>{fruit}</f:item>
 <f:by> and </f:by>
</f:join>

I have created a view helper for this syntax in my example extension "ballroom dancing".

Perhaps an optional argument "lastBy" eases things even more:

<f:join each="{0: 'apple', 1: 'banana', 2: 'mango'}" by=", " lastBy=" and " />

Which would yield: "apple, banana and mango"

Masi


More information about the TYPO3-project-typo3v4mvc mailing list