I’ve abandoned my original plan in favor of the greater functionality offered by the FullCalendar script (
http://arshaw.com/fullcalendar/). It seems to be a bit easier to integrate with modx Revolution.
As such, I am experimenting with whatever configuration options I can think of to find one that works. This has brought me to the process of constructing a snippet that will call the script. At this point I have a very basic snippet that registers the CSS and JS files that are needed to generate the calendar, but I’m having a tough time with the $modx->regClientStartupHTMLBlock call. For the sake of modularity, I have configured the call to retrieve the value of a chunk. The chunk includes a call to the getResources snippet for populating the calendar using an array. The challenge I am experiencing now is that usually nothing happens! On the rare occasion the registration calls take effect and the linked files appear in the HTML.
I’m not sure what is happening here as the calls should work. Any ideas?
FullCalendar basic snippet
<?php
$modx->regClientCSS('/assets/components/fullcalendar/fullcalendar.css');
$modx->regClientStartupScript('/assets/components/fullcalendar/fullcalendar.min.js');
$modx->regClientStartupHTMLBlock($modx->getChunk('tsaGetCalendarEvents'));
?>
The tsaGetCalendarEvents chunk
<script type="text/javascript">
$(document).ready(function() {
$('#calendar').fullCalendar({
header: {
left: 'month,agendaWeek,agendaDay',
center: 'title',
right: 'today prev,next'
},
editable: false,
events: [[getResources? &parents=`82` &tpl=`JSONListing` &tplFirst=`JSONListingFirst` &tplLast=`JSONListingLast` &includeTVs=`1` &includeContent=`1` &showHidden=`1` &sortby=`pagetitle` &sortdir=`ASC` &tvFilters=`EventStartDate==2010-08%` ]]
});
});
</script>