Created
May 21, 2012 05:56
-
-
Save anonymous/2760690 to your computer and use it in GitHub Desktop.
Calendar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfoutput> | |
<table border="1" width="100%" height="100%"> | |
<tr> | |
<cfloop index="x" from="1" to="7"> | |
<th>#dayOfWeekAsString(x)#</th> | |
</cfloop> | |
</tr> | |
</cfoutput> | |
<cfset firstOfTheMonth = createDate(year(now()), month(now()), 1)> | |
<cfset dow = dayofWeek(firstOfTheMonth)> | |
<cfset pad = dow - 1> | |
<tr> | |
<cfif pad gt 0> | |
<cfoutput><td colspan="#pad#"> </td></cfoutput> | |
</cfif> | |
<cfset days = daysInMonth(now())> | |
<cfset counter = pad + 1> | |
<cfloop index="x" from="1" to="#days#"> | |
<cfif x is day(now())> | |
<cfoutput><td bgcolor="yellow"></cfoutput> | |
<cfelse> | |
<td> | |
</cfif> | |
<cfoutput> | |
#x#</td> | |
</cfoutput> | |
<cfset counter = counter + 1> | |
<cfif counter is 8> | |
<cfoutput></tr></cfoutput> | |
<cfif x lt days> | |
<cfset counter = 1> | |
<tr> | |
</cfif> | |
</cfif> | |
</cfloop> | |
<cfif counter is not 8> | |
<cfset endPad = 8 - counter> | |
<cfoutput> | |
<td colspan="#endPad#"> </td> | |
</cfoutput> | |
</cfif> | |
</table> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment