我是coldfusion和Mura的新手并且很难做到以下几点:我能够从fullcalendar中获取一个单独的事件。但是,我正在尝试在日历6事件下面显示而不是1.如何以及在哪里添加cfloop来完成此操作?以下是代码:
<!--- Derived from: --->
<!--- Upcoming events --->
<cffunction name="MultipleFeaturedEvents">
<cfargument name="feedName" type="string" default="702771E7-155D-0201-11DF8865B175735F"/>
<cfargument name="maxMonths" type="numeric" default="3" />
<cfargument name="groupDailyEvents" default="true" />
<cfscript>
var rs = '';
var subRS = '';
var local = {};
local.util = $.getCalendarUtility();
local.rsItems = local.util.getCalendarItems(calendarid=arguments.feedName, start=Now(), end=DateAdd('m', val(4), Now()));
var qoq = new Query();
qoq.setDBType('query');
qoq.setAttributes(rs=local.rsItems, maxRows=val(1));
qoq.setSQL('
SELECT *
FROM rs
ORDER BY displaystart ASC
');
var qoqResult = qoq.execute().getResult();
local.it = $.getBean('contentIterator').setQuery(qoqResult);
</cfscript>
<cfsavecontent variable="local.str">
<cfoutput>
<!---<div>#local.it.hasNext()#</div>--->
<cfset local.item = local.it.next()>
<!--- TODO: set a default image if no image is available --->
<div class="hidden-xs col-md-2">
<p class="upcoming-events-image"><img src="#local.item.getImageURL()#" alt="#HTMLEditFormat(local.item.getTitle())#"> </p>
</div>
<div class="col-md-offset-0 col-md-4" id="featured-event">
<h3>Feature Event</h3>
<i class="fa fa-calendar fixIconCal"></i>
<!---#local.item.getDisplaystart()#--->
#LSDateFormat(local.item.getValue('displayStart'), "mmm d, yyyy")#
<cfquery dbtype="query" name="subRS1">
select *
from rsItems
where rsItems.contentid = <cfqueryparam value="#local.item.getValue('contentid')#" />
</cfquery>
<cfif subRS1.recordcount gt 1>
<!--- end date --->
<cfset enddate = ListLast(ValueList(subRS1.displaystop)) />
<cfif IsValid('date', enddate)>
- #LSDateFormat(enddate)#
</cfif>
</cfif>
<br />
<i class="fa fa-clock-o"></i>
#timeFormat(local.item.getValue('displayStart'), "h:mm tt")# - #timeFormat(local.item.getValue('displayStop'), "h:mm tt")#
<br />
<i class="fa fa-map-marker"></i>
#HTMLEditFormat(local.item.getMenuTitle())#
<!--- Summary --->
<div class="featured-event-summary">
<cfif Len(local.item.getValue('summary'))>
#local.item.getValue('summary')#
</cfif>
</div>
</div>
</cfoutput>
</cfsavecontent>
<cfreturn local.str />
</cffunction>
任何帮助将不胜感激。 感谢
更新
我已完成以下操作来完成循环,但仍然无法正常工作。我不确定我做错了什么,但任何帮助将不胜感激:
<cffunction name="MultipleFeaturedEvents">
<cfargument name="feedName" type="string" default="702771E7-155D-0201-11DF8865B175735F"/>
<cfargument name="maxMonths" type="numeric" default="3" />
<cfargument name="groupDailyEvents" default="true" />
<cfscript>
var rs = '';
var subRS = '';
var local = {};
local.util = $.getCalendarUtility();
local.rsItems = local.util.getCalendarItems(calendarid=arguments.feedName, start=Now(), end=DateAdd('m', val(4), Now()));
var qoq = new Query();
qoq.setDBType('query');
qoq.setAttributes(rs=local.rsItems, maxRows=val(1));
qoq.setSQL('
SELECT *
FROM rs
ORDER BY displaystart ASC
');
var qoqResult = qoq.execute().getResult();
local.it = $.getBean('contentIterator').setQuery(qoqResult);
</cfscript>
<cfsavecontent variable="local.str">
<cfoutput>
<cfset ctr= 1 />
<cfloop condition="(local.it.hasNext()) AND (ctr LT 6)">
<cfset local.item = local.it.next() />
<!--- TODO: set a default image if no image is available --->
<div class="hidden-xs col-md-2">
<p class="upcoming-events-image"><img src="#local.item.getImageURL()#" alt="#HTMLEditFormat(local.item.getTitle())#"> </p>
</div>
<div class="col-md-offset-0 col-md-4" id="featured-event">
<h3>Feature Event</h3>
<i class="fa fa-calendar fixIconCal"></i>
<!---#local.item.getDisplaystart()#--->
#LSDateFormat(local.item.getValue('displayStart'), "mmm d, yyyy")#
<cfquery dbtype="query" name="subRS1">
select *
from rsItems
where rsItems.contentid = <cfqueryparam value="#local.item.getValue('contentid')#" />
</cfquery>
<cfif subRS1.recordcount gt 1>
<!--- end date --->
<cfset enddate = ListLast(ValueList(subRS1.displaystop)) />
<cfif IsValid('date', enddate)>
- #LSDateFormat(enddate)#
</cfif>
</cfif>
<br />
<i class="fa fa-clock-o"></i>
#timeFormat(local.item.getValue('displayStart'), "h:mm tt")# - #timeFormat(local.item.getValue('displayStop'), "h:mm tt")#
<br />
<i class="fa fa-map-marker"></i>
#HTMLEditFormat(local.item.getMenuTitle())#
<!--- Summary --->
<div class="featured-event-summary">
<cfif Len(local.item.getValue('summary'))>
#local.item.getValue('summary')#
</cfif>
</div>
</div>
<cfset ctr++ />
</cfloop>
</cfoutput>
</cfsavecontent>
<cfreturn local.str />
</cffunction>