Last active
April 27, 2018 19:16
-
-
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
This file contains hidden or 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
<!--- 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> |
Thank you so much this solved a huge issue for one of my sites.
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
A better example can be found at: https://gist.github.com/stevewithington/18a6ef38e7234f1e1fc3