Hi guys:

I've got a working calendar that run on 2 loops to display the month. I've
got some test code that works similarly that displays the bold (when
there's something on) and red when it should show today (part 1)

but integrating it onto the real calendar is a nightmare! The whole month
displays red when it is today, not just today day (part 2). I just can't
see why AND the test works fine. the functions work OK
can anybody see what I've missed?

thanx
barry.b

<!--- part 1: the working test code --->

        <cfquery name="events" datasource="mlc">
                SELECT eventID, eventTitle, eventDes, eventDate, share, usrID 
                FROM events 
        </cfquery> 
        
        <cfset temp = "">
        
        <cfloop query="events">
                <cfif listLen(temp) is 0>
                   <cfset temp = datePart("d", events.eventDate)>
                <cfelse>
                        <cfset temp = temp & ", " & datePart("d", events.eventDate)>
                </cfif>
        </cfloop>

<cffunction name="isToday" output="true">
        <cfargument name="s">
        <cfargument name="n">
        <cfset dateColour = "##0000FF">
        <cfif s is n >
                <cfset dateColour = "##FF0000">
        </cfif>
        <cfreturn dateColour>
</cffunction>

<cffunction name="isFound" output="true">
        <cfargument name="num">
        <cfargument name="theList">
        <cfset weight = "normal">
        <cfif listContains(theList, num)>
                <cfset weight = "bold">
        </cfif>
        <cfreturn weight>
</cffunction>


<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>

<!--- <cfloop query="events">
<cfoutput>#DatePart('d', events.eventDate)#</cfoutput><br />
</cfloop> --->

<cfloop from="1" to="7" index="ii">
        <cfloop from="10" to="30" index="jj">

<!--- HERE: this checks conditions and sets style values --->
                <cfset col = isToday(ii, jj)>
                <cfset weight = isFound(jj, temp)>

<!--- HERE: this 
                <cfoutput><font color="#col#" style="font-Weight:#weight#">|#ii# : 
#jj#|</font></cfoutput>
        </cfloop>
        <br />
</cfloop>

</body>
</html>



<!--- Part 2: this should work but doesn't. --->

   <!--- The actual calander table is displayed with this --->
        
        <!---#####################################--->
        <table border = "1" cellpadding="4" cellspacing="0">
        <tr><!--- display the sun-sat day lables --->
        <cfloop from = "1" to = "7" index = "loopday">
                <td width = "30" align = "center" 
class="<cfoutput>#attributes.style#</cfoutput>">
                        <cfoutput>#Left(DayOfWeekAsString(LoopDay), 3)#</cfoutput>
                </td>
        </cfloop>
        </tr>

        <cfset ThisDay = 0><!--- create a counter to loop thru the days --->

        <!--- Loop through until the number of days in the month is reached.  --->
        
        <cfloop condition = "ThisDay LTE Days">
        <tr><!--- sun-sat columns --->
                
                <cfloop from = "1" to = "7" index = "loopday">
                        <cfif thisday is 0>
                                <cfif DayOfWeek(ThisMonthYear) IS LoopDay> 
                                        <cfset ThisDay = 1>
                          </cfif>
                  </cfif>
                  <cfif (thisday is not 0) and (thisday lte days)>
                                <cfset bgcolor = '##ffffff'>
                                <cfif url.day is thisday> 
                                <cfset bgcolor = "##0099FF"> 
                                </cfif>                 
                                <cfoutput><td bgcolor="#bgcolor#" 
class="#attributes.style#"></cfoutput>
                                
        <!--- HERE: SHOULD make this bold and red if today --->
                                <cfset col = isToday(sd, nd)>
                                <cfset weight = isFound(ThisDay, dateList)>            
 
                                <cfoutput><a 
href="#attributes.parentpage#?day=#thisday#&month=#url.month#&year=#url.year#"></cfoutput>
                                <cfoutput><font color="#col#" 
style="font-Weight:#weight#">#ThisDay#</font></a></cfoutput>
                                
                                        
                                <cfoutput></td></cfoutput>
                                <cfset ThisDay = ThisDay + 1>
                        <cfelse>
                                <td>&nbsp;</td>
                        </cfif>
                </cfloop>
        </tr>
        </cfloop><!--- end sun-sat columns --->

        </table>
        <!-------------------------  END MONTHLY CALENDAR ----------------->

---
You are currently subscribed to cfaussie as: [EMAIL PROTECTED]
To unsubscribe send a blank email to [EMAIL PROTECTED]

MXDU2004 + Macromedia DevCon AsiaPac + Sydney, Australia
http://www.mxdu.com/ + 24-25 February, 2004

Reply via email to