This question has been answered by BobRay. See the first response.
[[!SetTime? &month=`January` &year=`2013`]]
/* SetTime snippet */
$month=$scriptProperties['month'];
$year=$scriptProperties['year'];
$a_date = $month . ' ' . $year;
$min = strtotime($a_date);
$time = date("Y-m-t 23:59", strtotime($a_date));
$max = strtotime($time);
$where = array(
'published' => 1,
'deleted' => 0,
'publishedon:>=' => $min,
'publishedon:<=' => $max,
);
$modx->setPlaceholder('CalculatedWhere', $modx->toJSON($where));
return '';
/* SetTime snippet */
$month=$scriptProperties['month'];
$year=$scriptProperties['year'];
$a_date = $month . ' ' . $year;
$min = strtotime($a_date);
$time = date("Y-m-t 23:59", strtotime($a_date));
$max = strtotime($time);
$where = array(
'published' => 1,
'deleted' => 0,
'publishedon:>=' => $min,
'publishedon:<=' => $max,
);
return '$modx->toJSON($where)';[[!getResources? &where=`[[!SetTime? &month=`October` &year=`2013`]]` &includeTVs=`1` &tpl=`latest_sermon_block` &parents=`82` &depth=`0` &limit=`0`]]
<?php
/* SetTime snippet */
$month=$scriptProperties['month'];
$year=$scriptProperties['year'];
$a_date = $month . ' ' . $year;
$min = strtotime($a_date);
$time = date("Y-m-t 23:59", strtotime($a_date));
$max = strtotime($time);
$where = array(
'published' => 1,
'deleted' => 0,
'getTVValue('sermon_date'):>=' => $min,
'getTVValue('sermon_date'):<=' => $max,
);
$modx->setPlaceholder('CalculatedWhere', $modx->toJSON($where));
return $modx->toJSON($where);$modx->setPlaceholder('min', $min);
$modx->setPlaceholder('max', $max);
$where = array(
'published' => 1,
'deleted' => 0,
);
&tvFilters=`sermon_date>=[[+min],sermon_date<=[[+max]]` &processTVs=`0`
[[!getResources? &tvFilters=`sermon_date>=[[+min],sermon_date<=[[+max]]` &processTVs=`0` &where=`[[!SetTime? &month=`July` &year=`[[*pagetitle]]`]]`]]
[limit] => 0 [offset] => 0 [tvFilters] => sermon_date>= [tvFiltersAndDelimiter] => , [tvFiltersOrDelimiter] => ||
[[!getResources? &tvFilters=`sermon_date>=[[+min],sermon_date<=[[+max]]` &processTVs=`0` &where=`[[!SetTime? &month=`February` &year=`[[*pagetitle]]`]]`]]
[[!getResources? &tvFilters=`sermon_date>=[[+min],sermon_date<=[[+max]]` &processTVs=`0` &where=`[[!SetTime? &month=`March` &year=`[[*pagetitle]]`]]`]]
[[!getResources? &tvFilters=`sermon_date>=[[+min],sermon_date<=[[+max]]` &processTVs=`0` &where=`[[!SetTime? &month=`April` &year=`[[*pagetitle]]`]]`]]
[[!getResources? &tvFilters=`sermon_date>=[[+min],sermon_date<=[[+max]]` &processTVs=`0` &where=`[[!SetTime? &month=`May` &year=`[[*pagetitle]]`]]`]]
[[!getResources? &tvFilters=`sermon_date>=[[+min],sermon_date<=[[+max]]` &processTVs=`0` &where=`[[!SetTime? &month=`June` &year=`[[*pagetitle]]`]]`]]
</div>
<div class="clearfix grpelem" id="u636-9"><!-- content -->
[[!getResources? &tvFilters=`sermon_date>=[[+min],sermon_date<=[[+max]]` &processTVs=`0` &where=`[[!SetTime? &month=`July` &year=`[[*pagetitle]]`]]`]]
[[!getResources? &tvFilters=`sermon_date>=[[+min],sermon_date<=[[+max]]` &processTVs=`0` &where=`[[!SetTime? &month=`August` &year=`[[*pagetitle]]`]]`]]
[[!getResources? &tvFilters=`sermon_date>=[[+min],sermon_date<=[[+max]]` &processTVs=`0` &where=`[[!SetTime? &month=`September` &year=`[[*pagetitle]]`]]`]]
[[!getResources? &tvFilters=`sermon_date>=[[+min],sermon_date<=[[+max]]` &processTVs=`0` &where=`[[!SetTime? &month=`October` &year=`[[*pagetitle]]`]]`]]
[[!getResources? &tvFilters=`sermon_date>=[[+min],sermon_date<=[[+max]]` &processTVs=`0` &where=`[[!SetTime? &month=`November` &year=`[[*pagetitle]]`]]`]]
[[!getResources? &tpl=`` &tplFirst=`` &debug=`1` &tvFilters=`sermon_date>=[[+min],sermon_date<=[[+max]]` &processTVs=`0` &where=`[[!SetTime? &month=`December` &year=`[[*pagetitle]]`]]`]][[!SetTime? &month=`February` &year=`[[*pagetitle]]`]] [[!getResources? &tvFilters=`sermon_date>=[[+min],sermon_date<=[[+max]]` &processTVs=`0` &where=`[[+CalculatedWhere]]`]] [[!SetTime? &month=`March` &year=`[[*pagetitle]]`]] [[!getResources? &tvFilters=`sermon_date>=[[+min],sermon_date<=[[+max]]` &processTVs=`0` &where=`[[+CalculatedWhere]]`]]
$year = (int) $modx->resource->get('pagetitle');[[GetSermons? $tpl=`sermonTpl`]
<li>[[+pagetitle] - [[+publishedon]]</li>
/* GetSermons snippet */
$tpl = $modx->getOption('sermonTpl', $scriptProperties);
$year = (int) $modx->resource->get('pagetitle');
$months = array(
'January',
'February',
'March',
/* etc. */
);
$output = '<h2>Sermons/h2>';
foreach ($months as $month) {
$a_date = $month . ' ' . $year;
$min = strtotime($a_date);
$time = date("Y-m-t 23:59", strtotime($a_date));
$max = strtotime($time);
$where = array(
'published' => 1,
'deleted' => 0,
'publishedon:>=' => $min,
'publishedon:<=' => $max,
);
$c = $modx->newQuery('modResource');
$c->sortby('publishedon', 'ASC');
$c->where($where);
$sermons = $modx->getCollection('modResource', $c);
$output .= "\n<h3>" . $month . "</h3>\n<ul>";
foreach($sermons as $sermon) {
$fields = $sermon->toArray();
$output .= $modx->getChunk('sermonTpl', $fields);
}
$output .= "\n</ul>";
}
return $output;
<h2>Sermons</h2> <h3>January</h3> <ul> </ul> <h3>February</h3> <ul> </ul> <h3>March</h3> <ul> </ul> <h3>April</h3> <ul> </ul> <h3>May</h3> <ul> </ul> <h3>June</h3> <ul> </ul> <h3>July</h3> <ul> </ul> <h3>August</h3> <ul> </ul> <h3>September</h3> <ul> </ul> <h3>October</h3> <ul> </ul> <h3>November</h3> <ul> </ul> <h3>December</h3> <ul> </ul>