我有代码可以从FullCalendar.js中获取事件,并且工作正常。
但是,我很难设计它的方式,在每一列中,它有两个事件,中断并转到下一列。
代码是用coldfusion编写的,我读过我可以使用MOD。但是,我已经尝试了一个if语句和一个计数器来跟踪有多少事件,但它没有进入下一列
以下是我正在使用的代码。我试图瞄准"更多事件"当它碰到两个事件时,它会断开并转到下一列:
<!--- Derived from: --->
<!--- https://gist.github.com/stevewithington/18a6ef38e7234f1e1fc3 --->
<!--- Upcoming events --->
<cffunction name="dspDisplayEvents">
<cfargument name="feedName" type="string" default="8C702325-155D-0201-11D851267D5B4B2B" />
<cfargument name="maxMonths" type="numeric" default="3" />
<cfargument name="groupDailyEvents" default="true" />
<cfscript>
var rs = '';
var subRS = '';
var local = {};
local.feed = variables.$.getBean('feed').loadBy(name=arguments.feedName).setMaxItems(0).setNextN(0);
local.listIDs = '';
/*if ( feed.getIsNew() ) {
return '<div class="alert alert-info"><strong>Ooops!</strong> The Content Collection/Feed "<strong>#HTMLEditFormat(arguments.feedName)#</strong>" does not exist.</div>';
}*/
local.it = feed.getIterator(
from=Now()
, to=DateAdd('m', Val(3), Now())
, maxItems=3
);
rs = local.it.getQuery();
</cfscript>
<cfsavecontent variable="local.str">
<cfoutput>
<!--- #feed.getIsNew()# --->
<!--- #local.it.hasNext()# --->
<cfset ctr= 1 />
<cfloop condition="(local.it.hasNext()) AND (ctr LT 6)">
<cfset local.item = local.it.next() />
<cfif not ListFind(local.listIDs, local.item.getValue('contentid'))>
<cfif ctr eq 1>
<!--- TODO: set a default image if no image is available --->
<div class="bg-white1 centerEvent">
<div class="hidden-xs col-md-2 override-col-md-offset-3 margin-left">
<p class="image-center upcoming-events-image image-padding"><img src="#local.item.getImageURL()#" alt="#HTMLEditFormat(local.item.getTitle())#"> </p>
</div>
<div class="col-xs-offset-1 col-xs-10 col-md-offset-0 col-md-2" id="featured-event">
<div class="eventCenter">
<h4 class="featured1"><strong>FEATURED EVENT</strong></h4>
<hr class="hr" />
</div>
<div class="eventTop">
<small>
<!--- date --->
<!--- start date --->
#LSDateFormat(local.item.getValue('displayStart'))#
<!--- end date (if 'daily' event, and grouping is requested) --->
<cfif YesNoFormat(arguments.groupDailyEvents)>
<cfquery dbtype="query" name="subRS">
select *
from rs
where rs.contentid = <cfqueryparam value="#local.item.getValue('contentid')#" />
</cfquery>
<cfif subRS.recordcount gt 1>
<!--- end date --->
<cfset enddate = ListLast(ValueList(subRS.displaystop)) />
<cfif IsValid('date', enddate)>
- #LSDateFormat(enddate)#
</cfif>
</cfif>
<cfset local.listIDs = ListAppend(local.listIDs, local.item.getValue('contentid')) />
</cfif>
</small>
<h6 class="ellipsis h6size"><!--- Title --->
<a href="#local.item.getURL()#">
<div class="featured-event-title">
#HTMLEditFormat(local.item.getValue('title'))#
</div>
</a>
</h6>
<div>
<small>
<!--- Summary --->
<div class="featured-event-summary">
<cfif Len(local.item.getValue('summary'))>
#local.item.getValue('summary')#
</cfif>
</div>
</small>
</div>
<a href="##"><small>Learn more ></small></a>
<br />
</div>
</div><!---eventTop Div--->
<cfelse>
<cfif ctr eq 2>
**<div class="col-xs-offset-1 col-xs-10 col-md-offset-0 col-md-2 <!---eventBox--->" id="more-events">
<small><strong class="featured moreCenter">MORE EVENTS</strong></small><br />
</cfif>
<div class="eventSize eventDiv" style="border: 1px solid black;">
<small>#LSDateFormat(local.item.getValue('displayStart'))#</small><br />
<small><strong>#HTMLEditFormat(local.item.getValue('title'))#</strong></small><br />
</div>
<br />
</cfif>
</cfif>
<cfset ctr++ />
</cfloop>**
<!--- <button class="btn btn-info btn-md resizable" type="button" onClick="parent.location='http://oc2-web03/mura-6.2.6407/index.cfm/news-events/events-calendar/'" ><small>SEE ALL EVENTS ></small></button> --->
</div>
<button class="btn btn-info btn-md resizable buttonHome" type="button" onClick="parent.location='http://oc2-web03/regal_prod/index.cfm/news-events/events-calendar/'" ><small>SEE ALL EVENTS ></small></button><br />
</div><!---div bg-white1--->
</cfoutput>
</cfsavecontent>
<cfreturn local.str />
</cffunction>
更新这是我需要帮助调整的相关代码:
<div class="col-xs-offset-1 col-xs-10 col-md-offset-0 col-md-2 <!---eventBox--->" id="more-events">
<small><strong class="featured moreCenter">MORE EVENTS</strong></small><br />
</cfif>
<div class="eventSize eventDiv" style="border: 1px solid black;">
<small>#LSDateFormat(local.item.getValue('displayStart'))#</small><br />
<small><strong>#HTMLEditFormat(local.item.getValue('title'))#</strong></small><br />
</div>
<br />
</cfif>
</cfif>
<cfset ctr++ />
</cfloop>
任何有关如何使用MOD或示例的帮助都会很棒。