Hi all.
I'm experimenting with perl/CGI and now I want to create a menu for my webpage from a database.
I have following code:
sub print_menu
{
print table ( { -class=>'appletwidth'},
Tr (
td ( p ({ -class=>'applettitle' }, "Hoofdmenu" ),
get_menu()
)
)
);
}
sub get_menu
{
my $dbh=dbconnect::connect();
my $stmt = qq{ SELECT * from menu };
$sth = $dbh->prepare ($stmt);
$sth->execute ();
while ( my $row = $sth->fetchrow_hashref ())
{
print Tr ( td ( a ({href => "$row->{url}"}, "$row->{name}"
));
}
}
Why are the links in my menu printed outside the table?
Is it impossible to have you own function inside a table that adds some table rows?
Or is this the wrong way?
I'm experimenting with perl/CGI and now I want to create a menu for my webpage from a database.
I have following code:
sub print_menu
{
print table ( { -class=>'appletwidth'},
Tr (
td ( p ({ -class=>'applettitle' }, "Hoofdmenu" ),
get_menu()
)
)
);
}
sub get_menu
{
my $dbh=dbconnect::connect();
my $stmt = qq{ SELECT * from menu };
$sth = $dbh->prepare ($stmt);
$sth->execute ();
while ( my $row = $sth->fetchrow_hashref ())
{
print Tr ( td ( a ({href => "$row->{url}"}, "$row->{name}"
}
}
Why are the links in my menu printed outside the table?
Is it impossible to have you own function inside a table that adds some table rows?
Or is this the wrong way?