[TYPO3-mvc] Fluid for, if and ObjectStorage; Extbase Conceptual

Georg Ringer mail at ringerge.org
Wed Jan 19 07:43:42 CET 2011


Hi,
Am 19.01.2011 01:37, schrieb Thomas Allmer:
> 1) getFirst/Last Element in a for
> <f:for each="{0: 1, 1: 2, 2: 3}" as="element">
>     {element},
> </f:for>
> 
> output: 1, 2, 3, <<<--- howto get rid of this trailing comma

always check the comments in the viewhelper file! you can find the files
in EXT:fluid/classes/ViewHelpers/
Example
---------
 *   <f:for each="{0:1, 1:2, 2:3, 3:4}" as="foo" iteration="fooIterator">
 *     <li>Index: {fooIterator.index} Cycle: {fooIterator.cycle} Total:
{fooIterator.total}{f:if(condition: fooIterator.isEven, then: '
Even')}{f:if(condition: fooIterator.isOdd, then: '
Odd')}{f:if(condition: fooIterator.isFirst, then: '
First')}{f:if(condition: fooIterator.isLast, then: ' Last')}</li>
 *   </f:for>
---------

so you can use {fooIterator.isLast} to check if it is the last one


> is there any way I can check for the amount of elements that are stored
> in an Array/ObjectStorage and use it in an condition.

CountViewHelper ;)

> 3) Conceptual Question
> I have a "problem" something like this. The Domain Model consists of a
> few Objects. To make it easier let's assume it's like the blog example.
> Now what I need to do is, display a list of filters. These filters are
> dropdowns with all items currently available. For example a list of all
> tags. But there is no repository for tags, as it's usually not needed to
> display tags only. So how to get all tags?

If you want tags, you got a Tag Model and you need a Tag Repository.

Georg


More information about the TYPO3-project-typo3v4mvc mailing list