Skip to content

Instantly share code, notes, and snippets.

@stevewithington
Last active April 27, 2018 19:16
Show Gist options
  • Save stevewithington/f95c39df3af77d4d4368 to your computer and use it in GitHub Desktop.
Save stevewithington/f95c39df3af77d4d4368 to your computer and use it in GitHub Desktop.
Mura CMS : Example of how to group Mura CMS calendar events together. Another example can be found at https://gist.github.com/stevewithington/18a6ef38e7234f1e1fc3
<!--- See https://gist.github.com/stevewithington/18a6ef38e7234f1e1fc3 for a better example! --->
<cfscript>
it = $.getBean('feed').loadBy(name='Your Feed Name').getIterator(
from=Now()
, to=DateAdd('m', 2, Now())
);
rs = $.getCalendarUtility().filterCalendarItems(it.getQuery(),0);
</cfscript>
<ul>
<cfoutput query="rs" group="contentid">
<li>
<a href="#$.createHREF(filename=filename)#">#title#</a>: #LSDateFormat(displaystart)#
<cfquery dbtype="query" name="subRS">
select *
from rs
where rs.contentid = <cfqueryparam value="#contentid#" />
</cfquery>
<cfif subRS.recordcount gt 1>
<cfset enddate = ListLast(ValueList(subRS.displaystop)) />
<cfif IsValid('date', enddate)>
-#LSDateFormat(enddate)#
</cfif>
</cfif>
</li>
</cfoutput>
</ul>
@stevewithington
Copy link
Author

@Tigerlady
Copy link

Thank you so much this solved a huge issue for one of my sites.

@tbugler
Copy link

tbugler commented May 1, 2015

When an event spans into the next month or across multiple months (as an example a start date of June 17 and the carries on until August 8th):
<cfif subRS.recordcount gt 1> <cfset enddate = ListLast(ValueList(subRS.displaystop)) /> <cfif IsValid('date', enddate)> -#LSDateFormat(enddate)# </cfif>
returns the enddate as the first day of the next month (so in my example above the enddate displays as July 1 instead of Agust 8. Any ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment