Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Populating a calender

Status
Not open for further replies.

profwannabe

Programmer
Jan 6, 2001
53
US
I am trying to generate a calender of lectures for a course I am teaching that will populate lecture dates with URLs to assigned readings (each reading has a title and URL and has a foreign key to a Lecture table with the lecture date and title, as there is a 1-to-many relationship from lecture to readings). Ideally the calender would be monthly rather than for an entire semester. Any ideas?
 
It would help if you have a specific problem or question. You've basically outlined what you want your application to do but I'm not sure where you're having a problem.

GJ
 
Sorry about that! Part of the problem is that I am not sure how to proceed.

I guess I need to build off the date function to graphically generate a monthly calender, most likely as a table. Then each Tuesday and Thursday would be populated with the title of the lecture for that day and the hotlinked reading assignments. I would present the current month initially but allow for clicking to past or coming months (no problem there with adding/subtracting from the current month and setting the month parameter for each page accordingly).

The main difficulty for me is how to take a date and build a calender accordingly (although popluating the table may be more difficult than I am inclined to think).

Hope that makes my uncertainties clearer. Thanks in advance.

 
To create the calendar, you could setup a loop like this:

<cfloop index=&quot;x&quot; from=&quot;1&quot; to=#daysinmonth(now())#>

...... additional formatting and code here .........

#month(now())# / #x# / #year(now())#
<cfoutput query=&quot;lectures&quot;>.....</cfoutput>
<p><hr>

......... additional formatting and/or code here ........

</cfloop>

Within this loop, you could query your tables to get any lectures for each day like this.

<cfloop ....
<cfquery name=&quot;lectures&quot; ...>
select * from ....
where lectureDate = #createodbcdate(&quot;#month(now())#/#x#/#year(now())#&quot;)#
</cfquery>

.......... code from above ......
</cfloop>

I don't like this approach because you end up querying your database for every day in the month but I don't see a way to do one query and be able to loop through it and have a record for each day in the month. I'm assuming you want a full calendar and not just one showing days where there are lectures.

Let me know if this helps.
GJ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top