Bob Showalter [BS], on Friday, September 10, 2004 at 10:33 (-0400)
wrote these comments:
I want print all items into table, table should have 3 columns.
I don't know how to do it.
BS What you have prints one row with two columns. It looks like perhaps you
BS want two rows with three columns in
Here's my offer (you can change $num_items_in_td and $num_cols):
use CGI qw(:standard);
open (FH, items.txt) or die Can't open file. Cause: $!;
my @items = sort FH;
chomp(@items);
print header();
$num_cols = 4;
$num_items_in_td = 5;
for ($i = 0; defined($items[$i]); $i += $num_items_in_td) {
Sorry, I find out bug in previous code. Use this:
use CGI qw(:standard);
open (FH, items.txt) or die Can't open file. Cause: $!;
my @items = sort FH;
chomp(@items);
print header();
$num_cols = 2;
$num_items_in_td = 2;
for ($i = 0; defined($items[$i]); $i += $num_items_in_td) {
push @tds,
Here's my offer (you can change $num_items_in_td and $num_cols):
use CGI qw(:standard);
open (FH, items.txt) or die Can't open file. Cause: $!;
my @items = sort FH;
chomp(@items);
print header();
$num_cols = 2;
$num_items_in_td = 2;
for ($i = 0; defined($items[$i]); $i += $num_items_in_td) {
Just print 'table' and '/table' separately. Then, you are free to
when necessary. Alternatively, if you are doing a good deal of this,
look at HTML::Template on cpan--quite nice for doing this type of
thing.
Sean
On Sep 9, 2004, at 6:20 PM, Ing. Branislav Gerzo wrote:
Hi CGIers!
I have small
Sean Davis wrote:
Just print 'table' and '/table' separately.
Note that CGI has start_table and end_table methods. If you use function
style, you need to import them:
use CGI qw(:standard start_table);
print start_table;
...
print end_table;
Actually, you can do this with any
Ing. Branislav Gerzo wrote:
print table(
{-border=undef},
caption('Choose your favourite brand:'),
Tr({-align=CENTER,-valign=TOP},),
td($items[0], $items[1], $items[2]),
td($items[3], $items[4], $items[5])
);
I want print all
Hi CGIers!
I have small question about putting variables into CGI script, which
produces table, here is snip of code:
use CGI qw(:standard);
#...
open FH, items.txt or die Can't open $!;
my @items = sort FH;
print table(
{-border=undef},
caption('Choose your favourite brand:'),
Ing. Branislav Gerzo wrote:
I have small question about putting variables into CGI script, which
produces table, here is snip of code:
use CGI qw(:standard);
#...
open FH, items.txt or die Can't open $!;
my @items = sort FH;
print table(
{-border=undef},
caption('Choose your
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
: Charles K. Clarkson [CKC], on Thursday, September 9, 2004 at
: 17:37 (-0500) thinks about:
:
: : : print table(
: : {-border=undef},
: : : caption('Choose your favourite brand:'),
: : : Tr({-align=CENTER,-valign=TOP},),
:
: :
Charles K. Clarkson mailto:[EMAIL PROTECTED] wrote:
: Closer inspection shows the above code doesn't work (right).
: I think you wanted this.
:
: use CGI qw( table Tr td caption );
:
: my @items = ( 1 .. 6 );
: print
: table(
: caption( 'Choose your favourite brand:' ),
:
CKC I don't understand the question. What while loop?
CKC What would it be looping over?
I want print all items into table, table should have 3 columns.
I don't know how to do it.
Thanks and sorry for not clear question before.
--
Do you mean you want a loop for rolling over all
12 matches
Mail list logo