[TYPO3-mvc] How to create an archive menu of dates from my objects
Henjo Hoeksma
me at henjohoeksma.nl
Mon Jul 25 01:54:14 CEST 2011
Hi list,
I am trying to get a view together where I can show an 'archive menu'.
That is: a menu consisting out of year, respective months with the
number of objects attached to it.
In my controller I put all stuff into an array, like this:
public function archiveMenuAction(){
// First get all the items
$items = $this->itemRepository->findAll();
// Next loop through them and get the year and the month
$archive = array();
foreach($items as $item){
$archive[$item->getDate()->format('Y')][$item->getDate()->format('m')][]
= $item->getUid();
}
$this->view->assign('archive', $archive);
}
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!
Thanks in advance,
Henjo
More information about the TYPO3-project-typo3v4mvc
mailing list