Using the example on their page worked great except it doesn't show how to print them in HTML tables so the numbers and days align properly.
Below you can see the attempt I made and applying a table for the results but it doesn't work. Can someone repair my mistake(s) and let me know what I did wrong?
Also, I need to find a way that I can make each cell background of the table a certain color depending on the day of the week. I have a renting business for cabins and I want to print out the months in a calander format and colorcode the days according to different values (rented out already, open, closed, etc).
I know DB_File and SDBM_file but not MySQL and this project needs to be completed by the middle of December so it can be released to our users by the new year. Any ideas on how I can print the table based on results from a DB_File database if I store them it in such a way like:
In this example we could say that anything "rented" would have a red background, everything "open" would be blue.key = year-month , value = day::(either rented, open or closed) 2005-jan => 11::rented 2005-jan => 12::rented 2005-jan => 13::open
use Calendar::Simple; print header, start_html("test"); my @months = qw(January February March April May June July August September October November December); my $mon = shift || (localtime)[4] + 1; my $yr = shift || ((localtime)[5] + 1900); my @month = calendar($mon, $yr); print qq(<table width="297" border="1"> <tr>); print "<td>Su</td> <td>Mo</td> <td>Tu</td> <td>We</td> <td>Th</td> < +td>Fr</td> <td>Sa</td></tr><tr>"; foreach (@month) { print map { "<td>$_</td>" ? sprintf "%2d ", "$_" : ' &n +bsp;' } @$_; print "<tr>"; } print "</tr></table>";
20041129 Edit by ysth: change title from Creating tables
In reply to Creating HTML tables by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |