Thread HTML::Template + sub ärger: selectbox (8 answers)
Opened by decoder at 2006-05-23 01:08

decoder
 2006-05-23 12:40
#7755 #7755
User since
2006-03-30
22 Artikel
BenutzerIn
[default_avatar]
@Ronnie danke funktioniert super so :)

mit Data::Dumper muss ich mich noch einwenig anfreunden, hehe

Code: (dl )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/perl -w

use CGI;
use CGI::Carp qw(fatalsToBrowser);
use HTML::Template;
use strict;

my $template = HTML::Template->new(filename => '1.tmpl');
my $cgi = CGI->new();

sub build_selectbox {
my ($l_name, $selected, @options) = @_;
return { $l_name => [ map {
{
selectbox_label => $options[$_],
selectbox_value => $_,
selectbox_selected => $selected == $_ ? 1 : 0,
}
} (0 .. $#options) ] };
}


my @a_array = ('---','Berlin','Wien','Bern');

$template->param( build_selectbox( 'loop_kursort', 3, @a_array ) );

print "Content-Type: text/html; charset=utf-8\n\n", $template->output;

View full thread HTML::Template + sub ärger: selectbox