I just realized that this problem is related to my original problem. I'll go back to 
that thread.

Susan

>Charlie was kind enough to help me before to help me figure out how to skip
>the weekend dates for a 5 day calendar. That part worked perfectly.
>Before that I had changed the TWO CFLOOP's in the code below that currently
>says <CFLOOP FROM = "1" TO = "7" INDEX = "LoopDay"> to instead say  = "2" TO
>= "6". That made the calendar show Monday through Friday only. I thought I
>had it just right. In testing it, I found that it worked fine for about 3
>months and then stalled in month 4. If I put the CFLOOP's back to 1 to 7, it
>didn't stall. Nothing else changed. I tried it several times with the same
>result. Obviously I was not doing this the correct way.
>
>The dates on my calendar are working fine now, skipping the weekend dates.
>What is the correct way to eliminate those pesky weekend days of the week,
>so I have a proper 5 column calendar.
>
>Thank you. Please keep it simple, I'm a CF newbie.
>Susan
>
><html>
><head>
><cfinclude template="scripts.cfm">
>
></head>
>
><!--- Set the month and year parameters to equal the current values if they
>do not exist. --->
><CFPARAM NAME = "month" DEFAULT = "#DatePart('m', Now())#">
><CFPARAM NAME = "year" DEFAULT = "#DatePart('yyyy', Now())#">
><!--- Set the requested (or current) month/year date and determine the
>number of days in the month. --->
><CFSET ThisMonthYear = CreateDate(year, month, '1')>
><CFSET Days = DaysInMonth(ThisMonthYear)>
><!--- Set the values for the previous and next months for the back/next
>links. --->
><CFSET LastMonthYear = DateAdd('m', -1, ThisMonthYear)>
><CFSET LastMonth = DatePart('m', LastMonthYear)>
><CFSET LastYear = DatePart('yyyy', LastMonthYear)>
><CFSET NextMonthYear = DateAdd('m', 1, ThisMonthYear)>
><CFSET NextMonth = DatePart('m', NextMonthYear)>
><CFSET NextYear = DatePart('yyyy', NextMonthYear)>
><TABLE BORDER = "0" align="center" width="95%" bgcolor="#DBEDFF">
><TR>
><TD width="40%" ALIGN = "center"> <P>
><!--- Display the current month/year as well as the back/next links. --->
><p>�</p>
><cfoutput> <span class = "label"> <nobr class="tabText"></span>
><p><span class = "label"><a href =
>"calendarpost.cfm?month=#LastMonth#&year=#LastYear#"><<</a>��
>;</span><span class="h2">#MonthAsString(month)#</span><span class =
>"label">�</span><span class="h2">#year#</span><span class =
>"label">��<a href =
>"calendarpost.cfm?month=#NextMonth#&year=#NextYear#">>></a>
></span></p>
><form name="Go" action="calendarpost.cfm" method="post">
><select name="month" size="1">
><cfloop from = "1" to = "12" index = "LoopMonth">
><cfoutput>
><option value="#LoopMonth#" <cfif LoopMonth IS
>month>selected</cfif>>#MonthAsString(LoopMonth)# </CFOUTPUT>
></CFLOOP>
></select>
><select name="year" size="1">
><cfset lower = year - 2>
><cfset upper = year + 2>
><cfloop from = "#lower#" to = "#upper#" index = "LoopYear">
><cfoutput>
><option value="#LoopYear#" <cfif LoopYear IS year>selected</cfif>>#LoopYear#
></CFOUTPUT>
></CFLOOP>
></select>
><input type="submit" name="EDIT" value="Go">
></form>
></cfoutput> <p>�</p>
><TABLE BORDER = "1" width="100%" cellpadding="2">
><!--- Display the day of week headers.   --->
><TR>
><CFLOOP FROM = "1" TO = "7" INDEX = "LoopDay">
><CFOUTPUT>
><TD ALIGN = "center" bgcolor="##DBEDFF" class="tabText"> <div
>align="center">
><p><SPAN CLASS = "label">#Left(DayOfWeekAsString(LoopDay), 10)#</SPAN></p>
></div></TD>
></CFOUTPUT>
></CFLOOP>
></TR>
><!--- Set the ThisDay variable to 0.  This value will remain 0 until the day
>of the week on which the --->
><!--- first day of the month falls on is reached. --->
><CFSET ThisDay = 0>
><!--- Loop through until the number of days in the month is reached.  --->
><CFLOOP CONDITION = "ThisDay LTE Days">
><TR bgcolor="White">
><!--- Loop through each day of the week. --->
><CFLOOP FROM = "1" TO = "7" INDEX = "LoopDay">
><!--- If ThisDay is still 0, check to see if the current day of the week in
>the loop --->
><!--- matches the day of the week for the first day of the month. --->
><!--- If the values match, set ThisDay to 1. --->
><!--- Otherwise, the value will remain 0 until the correct day of the week
>is found. --->
><CFIF ThisDay IS 0>
><CFIF DayOfWeek(ThisMonthYear) IS LoopDay>
><CFSET ThisDay = 1>
></CFIF>
></CFIF>
><!--- If the ThisDay value is still 0, or it is greater than the number of
>days in the month, --->
><!--- display nothing in the column. --->
><!--- Otherwise, display the day of the month and increment the value. --->
><CFIF (ThisDay IS NOT 0) AND (ThisDay LTE Days)>
><cfset TheDate = CreateDate(year, month, ThisDay)>
><cfquery datasource="#DSN#" name="GetEvents">
>SELECT * FROM toaksElemEvents WHERE EVENT_DATE = #TheDate# ORDER BY
>EVENT_TIME ASC
></cfquery>
><cfquery datasource="#DSN#" name="GetTimelessEvents">
>SELECT * FROM toaksElemTimelessEvents WHERE EVENT_DATE = #TheDate# ORDER BY
>EVENT_NAME ASC
></cfquery>
><TD height="50" class="topicText" valign="top" width="14%" <cfif ThisDay IS
>DatePart("d",Now()) AND month IS DatePart("m",Now()) AND year IS
>DatePart("yyyy",Now())>bgcolor="Yellow"<cfelse>bgcolor="#FFFFCC"</cfif>><str
>ong><CFOUTPUT>#ThisDay#</CFOUTPUT></strong> <cfoutput
>query="GetTimelessEvents"><br>
></cfoutput> <cfoutput query="GetEvents"> </cfoutput> </TD>
><cfif dayOfWeek(theDate) EQ 6>
><CFSET ThisDay = ThisDay + 3>
><cfelse>
><CFSET ThisDay = ThisDay + 1>
></cfif>
><CFELSE>
><TD>�</TD>
></CFIF>
></CFLOOP>
></TR>
></CFLOOP>
></TABLE></TD>
></TR>
></TABLE>
><p align="center">�</p>
></body>
></html>
>
>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq

Get the mailserver that powers this list at 
http://www.coolfusion.com

                                Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
                                

Reply via email to