in reply to Help? - Trouble outputting data corectly
my @fields = qw( num address image neighborhood modelname modelelevation bedrooms +bathrooms typeoffoundation schooldistrict price paymentsfrom readydate phon +enumber email ); my %m; # key: neighborhood name. value: array of records. { open FILE, "< $datafile" or &fatal_error("Unable to open $data +file"); &lock(FILE); while ( <FILE> ) { chomp; my %rec; @rec{@fields} = split /``/; # put each record into the list for that neighborhood: push @{ $m{ $rec{'neighborhood'} } }, \%rec; } &unlock(FILE); close FILE; } open FILE, "< $template" or &fatal_error("Unable to open $template +"); &lock(FILE); while (<FILE>) { open FILE, "< $template" or &fatal_error("Unable to open $template +"); &lock(FILE); while (<FILE>) { if (/<!--messages-->/) { print <<EOF; <table width=400 border=0 cellpadding=3 cellspacing=3> <tr class="typewhite" bgcolor="#000000"> <td><b>Address</b></td> <td><b>Model Name</b></td> <td><b>Price</b></td> <td><b>Availability</b></td> </tr> EOF foreach $neighborhood ( sort keys %m ) { print <<EOF; <tr class="type" bgcolor="#EEEFDD"> <td colspan=4> <a href="../cristohomes/hoods/$neighborhood.shtml" cla +ss="type"> <b>$neighborhood</b> </a> </td> </tr> EOF for my $rec ( @{ $m{ $neighborhood } } ) { print <<EOF; <tr class="type"> <td> <a href="$indexcgi${queryswitch}action=display&num=$r- +>{'num'}" class="red"> $r->{'address'} </a> </td> <td> <a href="../cristohomes/homes/$r->{'modelname'}.shtml" + class="red"> "The $r->{'modelname'}" </a> </td> <td>$r->{'price'}</td> <td>$r->{'readydate'}</td> </tr> EOF } } print "</table>\n"; } } &unlock(FILE); close FILE;
jdporter
...porque es dificil estar guapo y blanco.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Help? - Trouble outputting data corectly
by endsinister (Initiate) on Dec 17, 2002 at 16:05 UTC |