Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Tables with Cgi.pm

by Kanji (Parson)
on May 11, 2002 at 19:39 UTC ( #165935=note: print w/ replies, xml ) Need Help??


in reply to Tables with Cgi.pm

If you supply an arrayref to CGI's tr method, it will take each element inside that arrayref to be a distinct row, so you need to remove the [ and ]...

print $query->table( $query->Tr( $query->td({width=>"15%"}, "1"), $query->td( "2"), ), );

The reason for this is so that you can build rows iteratively, and later pass them to tr and have it (ymmv) Do The Right Thing(tm)...

my @rows; foreach my $no (qw( one two three )) { push @rows, $query->td( $no ); } print $query->table( $query->Tr( \@rows ) );

    --k.



Comment on Re: Tables with Cgi.pm
Select or Download Code
Re: Re: Tables with Cgi.pm
by mephit (Scribe) on May 12, 2002 at 04:49 UTC
    Or, replace the comma in the anonymous array with a concentation operattor '.' . That way, both td()s will comprise one "element" in the array, thus, one table row with two columns. (Here I go learning something as I post again - imagine that.)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://165935]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (18)
As of 2015-07-02 13:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (38 votes), past polls