[TYPO3-mvc] How to create an archive menu of dates from my objects
Pankaj Lele
pankaj at lelesys.com
Mon Jul 25 08:05:52 CEST 2011
Hello Henjo,
> I tried several approaches now on creating a ViewHelper, or rendering it
> with Fluid as is, but all of them to no avail. I clearly lack some
> understanding here and would appreciate it if some of you could point me
> in the right direction!
I think one of the idea would be to add 2 new properties year and month
to your Item model. No need to add them to the table actually ( I have a
little doubt if this would work but worth trying. ). Then set these 2
properties in the __contruct() of the model.
public function __contruct() {
$this->setYear($this->getDate()->format('Y'));
$this->setMonth($this->getDate()->format('m'));
}
Then using the f:groupedFor [1] you can easily group your objects first
with the year and then month by nesting f:groupedFor
Thanks,
Pankaj
[1]
http://api.typo3.org/typo3v4/current/html/class_tx___fluid___view_helpers___grouped_for_view_helper.html
--
With best regards,
Pankaj Lele
---------------------------
CTO & Executive Director
Lelesys Infotech Pvt. Ltd.
Pune/Goa, India
Web: http://www.lelesys.com
[Certified TYPO3 Integrator]
More information about the TYPO3-project-typo3v4mvc
mailing list