in reply to cgi calander

It can be as easy as:
use strict; use HTML::Calendar::Simple; my $cal = HTML::Calendar::Simple->new; my $html = $cal->calendar_month; print $html;
Do check out HTML::Calendar::Simple it has a lot of useful functions (such as adding a pin up picture above the data!). If you need even more functionality there is HTML::CalendarMonthSimple or if you want to have total control HTML::CalendarMonth (which is built upon HTML::ElementTable).

Of course all these are on a calender month basis, but can be used as a basis and inspiration for your -15 to +15 calender.

CountZero

"If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law

Replies are listed 'Best First'.
Re^2: cgi calander
by mikejones (Scribe) on Feb 16, 2007 at 01:46 UTC
    ok I did and I will again to refresh. thank you
Re^2: cgi calander
by mikejones (Scribe) on Feb 27, 2007 at 00:05 UTC
    I am not able to use this module due to server Perl restrictions. I am taking an online class and they will not allow me to install this module due to the version of Perl and c compiler. Anywho...I still need some help as my date and daynames are not matching up when days pass or are subtracted. Shouldn't I be able to manipulate the @weeks_anonymous array using the SQL select dayofweek(curdate()); instead of using hardcoded undef's? Please help or any hints would be appreciated.
    thx!
    #!/usr/bin/perl #use strict; #use warnings; require "dbi-lib.pl"; use CGI qw/:standard *table start_ul/, (-unique_headers); use CGI::Carp qw(fatalsToBrowser); use DBI; my $cgi = new CGI; local $sth; #----------------------# # Function calls # #----------------------# print_header(); initialize_dbi(); #----------------# # Begin Main # #----------------# print $cgi->header(), $cgi->start_html ('Oreilly SQL Class, Lesson 11'), + # Header $cgi->h1 ({-style=>'Color:blue'},'Derek\'s SQL Class'); + # Body print "<u>",$cgi->strong('Date/Time CGI Table:'),"</u><p>"; print $cgi->caption('MySQL calendar table output, Lesson 11:'); print "<p>"; run_statement( "select date_format(curdate(), '%b %e, %Y');" ); my $today = $sth->fetchrow; run_statement("select dayofweek(curdate() );" ); my $dayofweek = $sth->fetchrow; print $dayofweek; #&run_statement( "select date_format(curdate()-2,'%W');" ); + #my $twodayago = $sth->fetchrow; #print "$twodayago <p>"; my @WeekDays = qw(Sunday Monday Tuesday Wednesday Thursday Friday Satu +rday); my ($day,$week,) = (0,0); my (@weeks, @weeks_anonymous,) = ((),()); foreach $day ('-15' .. '15') { run_statement( "select date_format(date_add(curdate(), interval '$ +day' day), '%b %e, %Y');" ); push (@weeks, $sth->fetchrow); } ## Begin Table ## print table({border=>undef}); print Tr ({-align=>'CENTER',-valign=>'TOP'}, td (\@WeekDays)); @weeks_anonymous = ( [ $weeks[0], $weeks[1], $weeks[2], $weeks[3] + ], [ $weeks[4], $weeks[5], $weeks[6], $weeks[7], + $weeks[8], $weeks[9], $weeks[10] ], [ $weeks[11], $weeks[12], $weeks[13], $weeks[14], + $weeks[15], $weeks[16], $weeks[17] ], [ $weeks[18], $weeks[19], $weeks[20], $weeks[21], + $weeks[22], $weeks[23], $weeks[24] ], [ $weeks[25], $weeks[26], $weeks[27], $weeks[28], + $weeks[29], $weeks[30], $weeks[31] ], ); foreach $element (@weeks_anonymous) { print Tr({-align=>'CENTER',-valign=>'TOP'}); for $date (@{$element}) { if (! defined $date) { print td (''); } elsif ($date eq $today) { print td(strong($date)); } else { print td ($date); } } print $cgi->end_Tr; } print $cgi->end_html;