Re: [htmltmpl] event calendar code
Brought to you by:
samtregar
From: Joel <htm...@jo...> - 2004-02-17 15:08:53
|
Why reinvent the wheel? Sure, HTML::Template is a fantastic module and is q= uite versatile, but coding up an accurate calendar is by no means a simple task.= =20 I recently discovered HTML::CalendarMonthSimple and found it to be extremel= y useful and easy to use. Combine it with HTML::Template and you have somethi= ng good going there (this is untested code): cal.pl ------ #!/usr/bin/perl -w=20 use HTML::CalendarMonthSimple; use HTML::Template; my $template =3D HTML::Template->new(filename =3D> 'cal.html'); my $cal =3D new HTML::CalendarMonthSimple('month' =3D> '2', 'year' =3D> '20= 04'); # Format the calendar $cal->width("100%"); $cal->border(1); $cal->bgcolor("#006633"); # Other calendar formatting is available, read perldoc for more info # Set some content in the calendar $cal->addcontent(2, "Groundhog Day!") $cal->addcontent(14, "Valentine's Day!") $template->param(CALENDAR =3D> $cal->as_HTML); print "Content-Type: text/html\r\\r\n"); print $template->output; cal.html -------- <HTML> <BODY> <TMPL_VAR NAME=3DCALENDAR> </BODY> </HTML> It doesn't get much simpler than that. Supply your own month/year to HTML::CalendarMonthSimple and you can do just about anything. Additionally, HTML::CalendarMonthSimple has the ability to place HTML, link= s and other text in each day of the calendar ($cal->addcontent), read the doc= s for more information. It's quite easy. --Joel >Sorry if this post is off-topic but I have a feeling people in this list = =3D >would have definitely come across it. > >I am looking to generate an event calendar using H::T. Can anyone help =3D >me with some pointers? code snippets? > >I did search the archives but could not find much info. > >Thanks, >Nishi > > > >------------------------------------------------------- >SF.Net is sponsored by: Speed Start Your Linux Apps Now. >Build and deploy apps & Web services for Linux with >a free DVD software kit from IBM. Click Now! >http://ads.osdn.com/?ad_id=3D1356&alloc_id=3D3438&op=3Dclick >_______________________________________________ >Html-template-users mailing list >Htm...@li... >https://lists.sourceforge.net/lists/listinfo/html-template-users |