[htmltmpl] RFC:- HTML::Template::Dropdown::Date
Brought to you by:
samtregar
From: Carl F. <htm...@fi...> - 2004-02-24 13:26:15
|
I know that the HTML::Template docs FAQ answers "What's the best way to create a <select> form element using HTML::Template" with 'use CGI'. However, I prefer to do it 'the other way'. I've created a module to help create the loop arrays for date/time menus and am requesting feedback on a suitable module name. Below is a very short example of use. The source is at http://www.fireartist.com/temp/source.txt . The pod is at http://www.fireartist.com/temp/pod.html . I've already created a full, working test suite. I recognise that I need to work on the pod a bit. ### TEMPLATE ### <select name="startDay"> <TMPL_LOOP startDay> <option value="<TMPL_VAR value>" <TMPL_VAR selected>> <TMPL_VAR label></option> </TMPL_LOOP> </select> ### PROGRAM ### #!/usr/bin/perl -w use strict; use CGI ':cgi'; use HTML::Template; use HTML::Template::Dropdown::Date; my $template = HTML::Template->new(filename => 'dates.tmpl'); my $start = HTML::Template::Dropdown::Date->new ( date => '2004-04-01', lessYears => 2, plusYears => 0 ); $template->param (startDay => $start->dayMenu()); print header(), $template->output(); ### Thanks, Carl Franks |