I have a model where one field is a date. I want to display elements from that model, grouped by year and by month, like this:
== 2013 ==
=== April ===
* Ele
First you need to iterate your resultset in the controller, save it into array, and make sure that every row has extracted date to separate indexes for year
and month
.
In such case you'll be able to use
view helper.
Other option is adding these fields (year
and month
) to your model and setting proper values while saving/updating the object. Using this approach you'll avoid the need of the controller's iteration mentioned above, buuuutttt... if you are going to access these records with common TYPO3's backend, you will need to use some postprocess hooks to set these fields after database operations.