in reply to Date::Calc to HTML::CalendarMonth

The second half of your question involves how to "highlight" these days on your calendar object. I'm not sure what you mean by highlight, but you will want to read up on how manipulations are performed on an HTML::Element, on which HTML:::ElementTable is built, from which HTML::CalendarMonth is derived.

You might be looking to do something like this, presuming your day numbers are in an array @days:

use HTML::AsSubs; ... # your @days gets filled in here my $c = HTML::CalendarMonth->new(month => $month, year => $year); $c->item(@days)->attr(bgcolor => 'wheat'); # Or maybe you want a link my $link = 'http://www.somewhere.com/' foreach my $day (@days) { my $href = $link . "?$day"; $c->item($day)->wrap_content(a({href => $href})); }

Matt

Replies are listed 'Best First'.
Re: Re: Date::Calc to HTML::CalendarMonth
by jonnyfolk (Vicar) on Nov 12, 2002 at 15:03 UTC
    Thanks very much for your reply (& by email). The first is very much what I'm looking for but unfortunately I can't find a way through to creating (@days). I've been working on it for hours but to no avail.

    I am looking at a range over several months, and I've been using push to strip down the array, hoping to create a further calendar with the remainder. Unfortunately this doesnot happen :(

    #!/usr/bin/perl -w use CGI qw(:standard); use Date::Calc qw(:all); use HTML::AsSubs; use HTML::Element; use HTML::CalendarMonth; print "Content-type: text/html\n\n"; @dates = (731158, 731159, 731160, 731161, 731178, 731600); foreach $days (@dates) { ($year,$month,$day) = Add_Delta_Days(1,1,1, $days - 1); if (($year eq 2002) && ($month eq 01)) { push (@days, $day); } else { print "ok"; } } my $c = HTML::CalendarMonth->new(month => $month, year => $year); $c->item(@days)->attr(bgcolor => 'wheat'); print $c->as_HTML;

    As I mentioned I thought that the 'push' would strip away the used scalars within @dates so I could use the foreach again to generate another calendar.

    If anyone could set me in the right direction to get this sorted I'd be very appreciative.

    (I also couldn't get this to work at all using strict so I turned it off in the end).