Coldfusion 如果行是当前日期,则插入定位点
我们有一个动态生成的计划,部分使用以下代码:Coldfusion 如果行是当前日期,则插入定位点,coldfusion,coldfusion-9,Coldfusion,Coldfusion 9,我们有一个动态生成的计划,部分使用以下代码: <cfloop from="0" to="6" index="x"> <cfset thisDate = dateFormat(dateAdd("d",x,theDate),"yyyy-mm-dd")> <cfoutput><tr><td colspan="4" class="date"><strong>#dateFormat(thisDa
<cfloop from="0" to="6" index="x">
<cfset thisDate = dateFormat(dateAdd("d",x,theDate),"yyyy-mm-dd")>
<cfoutput><tr><td colspan="4" class="date"><strong>#dateFormat(thisDate,"DDDD, M/D")#</strong></td></tr></cfoutput>
<cfif structKeyExists(dayData,thisDate)>
<cfif arrayLen(dayData[thisDate]) gt 0>
<cfloop from="1" to="#arrayLen(dayData[thisDate])#" index="y">
<cfoutput><tr>#dayData[thisDate][y]#</tr></cfoutput>
</cfloop>
<cfelse>
<cfoutput><tr><td colspan="4">There are no classes scheduled for this day</td></tr></cfoutput>
</cfif>
<cfelse>
<cfoutput><tr><td colspan="4">Schedule not available</td></tr></cfoutput>
</cfif>
</cfloop>
#日期格式(此日期,“DDDD,M/D”)#
#dayData[本日期][y]#
今天没有安排课程
时间表不可用
我试图做的是根据显示行中的日期是否为当前日期动态插入锚定(例如,)。所以我想要一个cfif,它将在日程安排中的当天行上显示锚点。目标是使用锚点链接到该链接
非常感谢您的任何建议。像这样的建议
<cfif dateFormat(now()),"yyyy-mm-dd") eq thisDate>
<a name="anchor" />
</cfif>
顺便说一句,你知道你可以在ColdFusion中循环日期吗
<cfloop from="#theDate#" to="#dateAdd("d", 6, theDate)#" index="thisDate" step="#CreateTimeSpan( 1, 0, 0, 0 )#">
</cfloop>
这假设日期的格式是CF视为日期的格式,如what now()返回的格式。成功了,谢谢。我不知道如何循环日期,谢谢你的提示。