[TYPO3-mvc] Best practice: where to prepare a model property and how to iterate

Franz Koch typo3.RemoveForMessage at elements-net.de
Tue Jul 20 10:57:04 CEST 2010


Hey,

>> An example:
>> The user creates three database records with the three dates:
>> 2010-07-12, 2010-06-11 and 2011-01-12.
>>
>> Now in FE view I want to render two main tabs named "2010" and "2011",
>> first with two subtabs named "07" and "06" and the second with one
>> subtab named "01".
>>
>> In my fluid template I iterate over the DB record objects. And these
>> objects have one property "date" but I need to split that dates into
>> year and month to get the information for tabs and subtabs.
>>
>> _Where_ to put that date-split stuff? I think I have to code some
>> getYear(), getMonth() methods in my model. Is that the correct position?
>
> That might suit.

if it's just about the rendering of the date in different formats, you 
can also use the <f:format.date> viewHelper for that. But in combination 
with the groupedFor viewHelper Jochen suggested, methods in the model 
might better fit your needs.

-- 
kind regards,
Franz Koch


More information about the TYPO3-project-typo3v4mvc mailing list