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

Alicia M. Cosenza aliciamc at dso.ufl.edu
Thu Sep 20 11:03:39 MDT 2007


Hi Bob,
 
I think it depends on how many events you are planning to have on
average.  I have a calendar that is generated on the web site I manage
in a month format because that is what my customer wanted.  I think
when there are only a view events it looks great but during the busy
months when he has 60+ events a month it stretches and looks funny to
me.  If you do the full month route you don't want to do 30-31 queries
because it will look really funny loading.  When I am at my computer
tomorrow I will look at how I did it.  I know I only needed one query
and some php to get it to work. Your first idea sounds neat and might
work better if you expect a really loaded schedule.  
 
Alicia

________________________________

From: fx.php_list-bounces at mail.iviking.org on behalf of Bob Patin
Sent: Tue 9/4/2007 2:30 PM
To: FX.php Discussion List
Subject: [FX.php List] Best way to do a month calendar



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 <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 


_______________________________________________ 
FX.php_List mailing list 
FX.php_List at mail.iviking.org 
http://www.iviking.org/mailman/listinfo/fx.php_list 



More information about the FX.php_List mailing list