Forums

12 month calendar

daffy 10 Aug, 2010
A challenge because I am struggling !

I am writing a booking system. I want a page showing the state of bookings over the next 12 months from this month. The first calendar being 'this month' whatever month that may be.
I can easily write a month calendar but when I try to do 12 months the page gets slow.

I first tried putting an image of a grid of 12 little calendar frames using absolute positioning.
and filling each cell by painting the required data into it using PHP echo statements, again of course using absolute positioning. This is the fastest so far but quite tricky to get the positioning exactly right...and how will it behave on other computers using other browsers ?

I then tried echoing each html code for a table by PHP for each little calendar, and for some reason this was very slow. (But the layout was easier and should fit other browsers).

Since I have all the information about bookings on the database, including dayNames, dates etc why don't I try to put one database record to construct one cell on screen. OK the months need odd blanks to take up the fact that we dont have equal months. Include those blanks as records on the database as well. I don't care how complex and slow the database is to fill as this is done one record at a time.

Any simple suggestions from clever people welcomed!!
Thanks
--
Dave
GreyHead 10 Aug, 2010
Hi Dave,

I'd use a PHP script to create the calendar framework. I Googled and found one here that would probably do the trick. Would need some additions to the code to show the info you need.

Bob
daffy 11 Aug, 2010
Thanks Bob,
A very useful pointer. I have done a 12 month calendar which is not too slow but my programming is pedestrian so I shall study this version carefully.
I suppose I should use short names for speed because it is not a compiled language as I am used to, but I use long ones !!
I put 12 little images of a calendar frame on a page at absolute position and of fixed cell size then paint in numbers in calculated positions. It works well in firefox but I have yet to try it in IE etc.
And of course it is 12 times as slow as 1 month!
I use a Saturday start because the bookings start on a Saturday.
I did not realise until I had done it that October this year requires 6 rows of numbers if the calendar starts on a Saturday !
Thanks again
--
Dave
This topic is locked and no more replies can be posted.