SunQuest
           ColdFusion Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreColdFusion Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
1200+ fellow developers rate and compare features of the top IDEs, like Visual Studio, Eclipse, RAD, Delphi and others, across 13 categories. Enjoy this FREE Download of the IDE User Satisfaction Study by Evans Data Corporation. Download Now!
  #1  
Old December 2nd, 2004, 06:00 PM
Panther893's Avatar
Panther893 Panther893 is offline
MostarDesigns.com
Dev Shed Novice (500 - 999 posts)
 
Join Date: Mar 2004
Posts: 806 Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 5 Days 17 h 53 m 24 sec
Reputation Power: 56
Send a message via MSN to Panther893
Question a tricky subject

ok im trieing to make a scheduel script like what this page has http://leagues.theigs.com/gr/ViewTe...action=schedule

now i got everything down except for the part where they match up the correct day numbers with the day names based on what month you are viewing. if anyone has a solution please help because i am truly stumped.

now this is my code below:

Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Scheduel</title>
</head>

<body>
<cfset loopnumber = 1>
<cfset cellcount = 1>
<cfset numberofdays = #DaysInMonth(dateformat(now()))#>
<cfset totalrows = 7>
<cfset totalrowscountdown = totalrows - 0>
<table width="536" cellspacing="10" cellpadding="0" border="0" class="style">
<tr>
  <td align="center"><strong>Sun</strong></td>
  <td align="center"><strong>Mon</strong></td>
  <td align="center"><strong>Tue</strong></td>
  <td align="center"><strong>Wed</strong></td>
  <td align="center"><strong>Thu</strong></td>
  <td align="center"><strong>Fri</strong></td>
  <td align="center"><strong>Sat</strong></td>
</tr>
<cfloop index="i" from="1" to="#numberofdays#">
<cfif #cellcount# is 1>
<tr>
</cfif>

<td width="100" align="center" valign="top">

<table width="100" border="0" cellspacing="1" cellpadding="4" bgcolor="666666" class="style">
  <tr>
    <td height="75" valign="top" bgcolor="<cfif "#day(dateformat(now()))#" is "#loopnumber#">f6f6f6<cfelse>cccccc</cfif>" align="left">
	<cfoutput>#loopnumber#</cfoutput>
	</td>
  </tr>
</table>


</td>

<cfif #cellcount# is 7>
</tr>
</cfif>

<cfset totalrowscountdown = totalrowscountdown - 1>

<cfif #totalrowscountdown# is 0>

<cfset cellsleft = 7 - #cellcount#>

<cfif #cellsleft# is 0>
</tr>
<cfelse>

<cfloop condition="#cellscount# GREATER THAN OR EQUAL TO 1">
<td width="100" align="center">&nbsp;</td>
<cfset cellscount = cellscount - 1>

<cfif #cellscount# is 0>
</tr>
</cfif>

</cfloop>
</cfif>

</cfif>

<cfif #cellcount# is 7>
<cfset cellcount = 1>
<cfelse>
<cfset cellcount = cellcount + 1>
</cfif>
<cfset loopnumber = #loopnumber# + 1>
</cfloop>
</table>
</body>
</html>

Reply With Quote
  #2  
Old December 2nd, 2004, 06:05 PM
Panther893's Avatar
Panther893 Panther893 is offline
MostarDesigns.com
Dev Shed Novice (500 - 999 posts)
 
Join Date: Mar 2004
Posts: 806 Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 5 Days 17 h 53 m 24 sec
Reputation Power: 56
Send a message via MSN to Panther893
oooops i posted twice.... eek....

Reply With Quote
  #3  
Old December 2nd, 2004, 06:59 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,618 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 9 h 44 m 33 sec
Reputation Power: 53
If you're just trying to output a calendar I think it can be done more simply, something like this:

Code:
<cfoutput>
<cfset targetMonth = '12/1/2004' />
<cfset firstDayOfMonthDayOfWeek = dayOfWeek( '#month( targetMonth )#/1/#year( targetMonth )#' ) /> <br /> 
<cfset dayCounter = 1 />
<cfset monthStarted = false />

<table border="1">
	<tr>
		<td>Sun</td>
		<td>Mon</td>
		<td>Tues</td>
		<td>Wed</td>
		<td>Thurs</td>
		<td>Fri</td>
		<td>Sat</td>
	</tr>  
	<cfloop condition="#dayCounter# lte #daysInMonth( targetMonth )#">
	<tr>
		<cfloop index="thisDayOfWeek" from="1" to="7">
		<td>
			<cfif firstDayOfMonthDayOfWeek eq thisDayOfWeek and not monthStarted>
				#dayCounter#
				<cfset monthStarted = true />
			<cfelseif monthStarted and dayCounter lte daysInMonth( targetMonth )>
				#dayCounter#
			<cfelse>
				&nbsp; 	
			</cfif>
		</td>
		<cfif monthStarted>
			<cfset dayCounter = dayCounter + 1>
		</cfif>
		</cfloop>
	</tr>
	</cfloop>
</table>
</cfoutput>
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian.
How to Post a Question in the Forums

Reply With Quote
  #4  
Old December 4th, 2004, 07:12 PM
Panther893's Avatar
Panther893 Panther893 is offline
MostarDesigns.com
Dev Shed Novice (500 - 999 posts)
 
Join Date: Mar 2004
Posts: 806 Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 5 Days 17 h 53 m 24 sec
Reputation Power: 56
Send a message via MSN to Panther893
ok I got your code to work perfectly but i made some adjustments and now i get an error when i run it on the 11th month of the year. here is my code below.

Code:
<center>
<cfoutput>
<cfset targetMonth = '#monthID#/#day(1)#/#yearID#' />
<cfset firstDayOfMonthDayOfWeek = dayOfWeek( '#month( targetMonth )#/1/#year( targetMonth )#' ) /> <br /> 
<cfset dayCounter = 1 />
<cfset monthStarted = false />

<cfset nextmonth = #monthID# + 1>
<cfif "#nextmonth#" gt "12">
  <cfset nextmonth = 1>
  <cfset nextyear = #yearID# + 1>
<cfelse>
  <cfset nextyear = #yearID#>
</cfif>

<cfset prevmonth = #monthID# - 1>
<cfif "#prevmonth#" lt "1">
  <cfset prevmonth = 12>
  <cfset prevyear = #yearID# - 1>
<cfelse>
  <cfset prevyear = #yearID#>
</cfif>

<table border="0" class="style" cellpadding="3" cellspacing="2">
    <tr>
	  <td align="center"><strong><a href="index.cfm?pageid=#pageid#&unitpage=#unitpage#&monthID=#prevmonth#&yearID=#prevyear#">Prev Month</a></strong></td>
	  <td align="center"><strong><a href="index.cfm?pageid=#pageid#&unitpage=#unitpage#&monthID=#monthID#&yearID=#yearID#">Refresh</a></strong></td>
	  <td align="center"><strong><a href="index.cfm?pageid=#pageid#&unitpage=#unitpage#&monthID=#nextmonth#&yearID=#nextyear#">Next Month</a></strong></td>
	  <form action="index.cfm" method="post">
	  <td align="right" colspan="4"></td>
	  </form>
	</tr>
	<tr>
	  <td colspan="7" height="10"></td>
	</tr>
	<tr>
		<td align="center"><strong>Sun</strong></td>
		<td align="center"><strong>Mon</strong></td>
		<td align="center"><strong>Tues</strong></td>
		<td align="center"><strong>Wed</strong></td>
		<td align="center"><strong>Thurs</strong></td>
		<td align="center"><strong>Fri</strong></td>
		<td align="center"><strong>Sat</strong></td>
	</tr>  
	<cfloop condition="#dayCounter# lte #daysInMonth( targetMonth )#">
	<tr>
		<cfloop index="thisDayOfWeek" from="1" to="7">
		<cfif "#len(dayCounter)#" is "1">
	      <cfset "dayCounter2" = "#right(dayCounter, 1)#">
		  <cfif "#dayCounter2#" is "1">
		    <cfset "daytitle" = "st">
		  <cfelseif "#dayCounter2#" is "2">
		    <cfset "daytitle" = "nd">
		  <cfelseif "#dayCounter2#" is "3">
		    <cfset "daytitle" = "rd">
		  <cfelse>
		    <cfset "daytitle" = "th">
		  </cfif>
		<cfelseif "#len(dayCounter)#" is "2">
	      <cfset "dayCounter2" = "#right(dayCounter, 2)#">
		  <cfif "#dayCounter2#" is "21" or "#dayCounter2#" is "31">
		    <cfset "daytitle" = "st">
		  <cfelseif "#dayCounter2#" is "22" or "#dayCounter2#" is "32">
		    <cfset "daytitle" = "nd">
		  <cfelseif "#dayCounter2#" is "23" or "#dayCounter2#" is "33">
		    <cfset "daytitle" = "rd">
		  <cfelse>
		    <cfset "daytitle" = "th">
		  </cfif>
		</cfif>
		<td valign="top" width="80" height="80" 
		  <cfif "#dayCounter#" is "#day(dateformat(now()))#" and firstDayOfMonthDayOfWeek eq thisDayOfWeek and not monthStarted>
		  bgcolor="efefef"
		  title="Nothing is happening on the #dayCounter##daytitle#"
		  <cfelseif "#dayCounter#" is "#day(dateformat(now()))#" and monthStarted and dayCounter lte daysInMonth( targetMonth )>
		  bgcolor="efefef"
		  title="Nothing is happening on the #dayCounter##daytitle#"
		  <cfelseif "#dayCounter#" is not "#day(dateformat(now()))#" and  firstDayOfMonthDayOfWeek eq thisDayOfWeek and not monthStarted>
		  bgcolor="cccccc"
		  title="Nothing is happening on the #dayCounter##daytitle#"
		  <cfelseif "#dayCounter#" is not "#day(dateformat(now()))#" and  monthStarted and dayCounter lte daysInMonth( targetMonth )>
		  bgcolor="cccccc"
		  title="Nothing is happening on the #dayCounter##daytitle#"
		  <cfelse>
		  </cfif>>
			<cfif firstDayOfMonthDayOfWeek eq thisDayOfWeek and not monthStarted>
				#dayCounter#
				<cfset monthStarted = true />
			<cfelseif monthStarted and dayCounter lte daysInMonth( targetMonth )>
				#dayCounter#
			<cfelse>
				&nbsp; 	
			</cfif>
		</td>
		<cfif monthStarted>
			<cfset dayCounter = dayCounter + 1>
		</cfif>
		</cfloop>
	</tr>
	</cfloop>
	<tr>
	  <td colspan="7" bgcolor="cccccc" align="center">#dateformat(now())#</td>
	</tr>
</table>
</cfoutput>
</center>



Reply With Quote
  #5  
Old December 6th, 2004, 04:09 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,618 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 9 h 44 m 33 sec
Reputation Power: 53
What's the error?

Reply With Quote
  #6  
Old December 6th, 2004, 06:09 PM
Panther893's Avatar
Panther893 Panther893 is offline
MostarDesigns.com
Dev Shed Novice (500 - 999 posts)
 
Join Date: Mar 2004
Posts: 806 Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 5 Days 17 h 53 m 24 sec
Reputation Power: 56
Send a message via MSN to Panther893
1/31/2004" is an invalid date format. The error occurred on line 4.

Reply With Quote
  #7  
Old December 6th, 2004, 08:06 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,618 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 9 h 44 m 33 sec
Reputation Power: 53
Are you passing in the date with that quote mark at the end? Because 1/31/2004 IS a valid date. But 1/31/2004" is not a valid date due to the quote mark.

Reply With Quote
  #8  
Old December 7th, 2004, 12:36 AM
Panther893's Avatar
Panther893 Panther893 is offline
MostarDesigns.com
Dev Shed Novice (500 - 999 posts)
 
Join Date: Mar 2004
Posts: 806 Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 5 Days 17 h 53 m 24 sec
Reputation Power: 56
Send a message via MSN to Panther893
no i just gotgot to copy the starting quote mark along with it. im passing the month and year values in the url.

Reply With Quote
  #9  
Old December 7th, 2004, 08:32 AM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,618 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 9 h 44 m 33 sec
Reputation Power: 53
Well something must not be passing correctly, because this code returns true:

#isDate( '1/31/2004' )#

I'm thinking maybe this part is incorrect:

<cfset targetMonth = '#monthID#/#day(1)#/#yearID#' />

Try this instead:

<cfset targetMonth = '#monthID#/1/#yearID#' />

Reply With Quote
  #10  
Old December 7th, 2004, 01:02 PM
Panther893's Avatar
Panther893 Panther893 is offline
MostarDesigns.com
Dev Shed Novice (500 - 999 posts)
 
Join Date: Mar 2004
Posts: 806 Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 5 Days 17 h 53 m 24 sec
Reputation Power: 56
Send a message via MSN to Panther893
ok yeah that works, any idea why it was doing that?

Reply With Quote
  #11  
Old December 7th, 2004, 01:07 PM
kiteless kiteless is offline
Moderator
Dev Shed Expert (3500 - 3999 posts)
 
Join Date: Jun 2002
Location: Raleigh, NC
Posts: 3,618 kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level)kiteless User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 Week 4 Days 9 h 44 m 33 sec
Reputation Power: 53
The day() function expects a full date, not just a day of the month as a single value.

Reply With Quote
  #12  
Old December 7th, 2004, 01:43 PM
Panther893's Avatar
Panther893 Panther893 is offline
MostarDesigns.com
Dev Shed Novice (500 - 999 posts)
 
Join Date: Mar 2004
Posts: 806 Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level)Panther893 User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 5 Days 17 h 53 m 24 sec
Reputation Power: 56
Send a message via MSN to Panther893
cool, i love coming to these forums i learn something new every time

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreColdFusion Development > a tricky subject


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump