[FX.php List] Best way to do a month calendar

Bob Patin bob at patin.com
Tue Sep 4 12:30:47 MDT 2007


I'm about to do a month calendar in FX, and am mulling the various  
ways to do this. I've already done the week-at-a-glance, which is  
working great, but there are a bunch of things I'm trying to decided  
how to do:

1. To have events show up on a consistent grid, I'm considering  
creating 24 rows (one per half-hour), so that the first row = 8AM.

Then, if there is a 2-hour event, I'd put the event in the first row,  
and then color the first 4 rows with the same color, no border, so  
that it looks like a block of color.

That way, events would line up across the week; as I have it now,  
events start at the top of each column and fill in; it works fine,  
but doesn't give the user the common graph where all 10AM events are  
lined up, no matter what comes before them.

2. To do a month calendar, I'm considering a couple of methods:

a) (which I used in the week at a glance) compute the 7 days of the  
currently-viewed week, then do 7 queries, one for each column (a  
column equates to a day of the week). Using 7 FOREACH loops, plug in  
the events for each day

b) do a single query for a date range, and then use a single FOREACH  
loop to populate an array that I could then use to populate the table.

There are several issues with method b; the first is what to do when  
there are multiple events for a single day. I thought about somehow  
using an array so that the first dimension is the day of the month  
(like this: array[$day_of_month][$event]), and the 2nd dimension  
would be the events. However, this means I'd have as many as 31 event  
counters to keep track of, since I'd have to loop through the query  
results and put the current record into the proper slot by day of the  
month and event.

Has anyone done something like this? If so, how did you populate your  
table on the web?

Last question: When I refresh my week view page, it's really fast  
with 7 queries; would I find fast enough results by just doing 31  
queries, one for each day of the current month?

Fishing for expert opinions; all comments welcome!

Bob Patin
Longterm Solutions
bob at longtermsolutions.com
615-333-6858
http://www.longtermsolutions.com
Member of FileMaker Business Alliance and FileMaker TechNet

   CONTACT US VIA INSTANT MESSAGING:
      AIM or iChat: longterm1954
      Yahoo: longterm_solutions
      MSN: tech at longtermsolutions.com
      ICQ: 159333060

--------------------------
Contact us for FileMaker hosting for all versions of FileMaker
PHP • CDML • Full email services • Free DNS hosting • Colocation •  
Consulting




More information about the FX.php_List mailing list