Some creative urge over took me and i figured out the date calculations to go with your HTML output! ;)

use strict; use warnings; use Data::Dumper; use CGI::Pretty qw(:standard start_table end_table start_Tr end_Tr), ( +-unique_headers); #use CGI::Carp qw(fatalsToBrowser); use Date::Calc qw(Week_of_Year Monday_of_Week Add_Delta_Days Standard +_to_Business); my @day = (2007,2,10); my @week = Week_of_Year(@day); my @weeks = []; for my $delta (-15..15) { my @n_day = Add_Delta_Days(@day,$delta); #calculate which week we are in my @n_week = Week_of_Year(@n_day); #calculate the day of the week my @b_day = Standard_to_Business(@n_day); #put it in a nice array of arrayref $weeks[$n_week[0]]->[$b_day[2]-1] = $n_day[2]; } # this seemed easier than calculating the smallest week # number and subtracting that from each index @weeks = grep {defined} @weeks; print header(); print start_html (-title => "Calendar sample"); my @weekDays = qw(Mon Tue Wed Thur Fri Sat Sun); print start_table(); print Tr ({-align=>'CENTER',-valign=>'TOP'}, td (\@weekDays)); for my $week (@weeks) { print start_Tr({-align=>'CENTER',-valign=>'TOP'}); for my $date (@$week) { if (! defined $date) { print td (''); } elsif ($date == $day[2]) { print td(strong($date)); } else { print td ($date); } } print end_Tr(); } print end_html ();

___________
Eric Hodges

In reply to Re^2: cgi calander by eric256
in thread cgi calander by mikejones

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.