Created
March 19, 2011 01:08
-
-
Save Mark-H/877111 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$c = $modx->newQuery('modResource'); | |
$c->where(array( | |
'published' => 1, | |
'hidemenu' => 0)); | |
$c->sortby('unpub_date','asc'); | |
$c->limit(10); | |
$resources = $c->getCollection('modResource',$c); | |
$months = array(); | |
foreach ($resources as $res) { | |
$m = date('n',strtotime($res->get('unpub_date'))); | |
$months[$m][] = $res; | |
} | |
// Now loop through the months and add to the output. | |
$o = ''; | |
$month_names = array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"); | |
foreach ($months as $mon) { | |
$o .= $month_names[$mon]; | |
foreach ($mon as $event) { | |
$o .= $modx->getChunk('tplChunkName',$event->toArray()); | |
} | |
} | |
return $o; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment