Skip to main content.

Calendar ver.1

This is the first calendar system, using Smarty to help generating the table code. All I need to do is to generate a simple array filled with the content of each cell. As you can see, it will highlight the current date according to server clock. It can be further modified to offer more features, such as a link in each date to blog entries, or a reminder, etc. There is a bug though, as it uses UNIX timestamp to generate the calendar, it will run into error if the date is beyond the start of the timestamp. I am not sure if it will run out of bound for a future date though... So I set a "start year" to prevent the out of bound error. In this example, I choose the year 1980, and the code will display January 1980 for any month earlier than this...

Also, there is the "previous month" and "next month" link feature. It is not part of the table code, so it can be placed differently if required.


May 2012

Sun Mon Tue Wed Thr Fri Sat
1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31              
April 2012   June 2012