I have JPDeni's short/long record mod to DBMan installed, and I've modified html.pl quite a bit, but it's working fine (default database is at http://www.bigday.tv/scripts/db.cgi?db_default). Now, though, I want more than one line of info displayed in each short record, which takes up a single table row in the HTML generated by sub html_record in subs html_view_success, html_delete_form, and html_modify_form. So I want the alternating rows starting with the second table cell from the left to be different colors -- i.e., starting with the second table cell, the row for the first record is green (#F0FFF0), the next record (row down) white, the third green, the fourth white, etc.
I've been working on this for six hours, but I'm really lame at Perl and can't get it right. What I've done is only manage to change all the rows one color or the other. I'm pretty sure the solution involves creating an array with a looping routine within either html_record or the other subs.
Here's what I have so far (wincing from embarrassment):
In sub html_view_success (and similarly in sub html_delete_form, and sub html_modify_form),
tried this in the rec_count loop (red is new):
$rec_count = 1;
$odd = "#F0FFF0";
$even = "#FFFFFF";
$bgcol = $even;
@bgcols = [0];
print qq|
<table width="758" cellpadding="7" cellspacing="0" border="0">
<tr>
<td><img src="/images/shim.gif" width="1" height="1" vspace="0" hspace="68" border="0"></td>
<td><img src="/images/shim.gif" width="1" height="1" vspace="0" hspace="296" border="0"></td>
</tr> |;
for (0 .. $numhits - 1) {
if ($bgcol==$even) { #if the last row was honeydew
$bgcol=$odd #make the next one white
} else { #if the last one was white
$bgcol=$even #make the next one honeydew
}
push(@bgcols,$bgcol);
print qq|
<tr>
<td> </td>|;
&html_record (&array_to_hash($_, @hits, @bgcols));
print "</tr>";
++$rec_count;
}
In sub html_record, changed 'print "<td>" to this:
print "<td bgcolor=$bgcol>";
ANY help is welcome. TIA!
William
William Hillis
4411 Governor Ln SE
Olympia, WA 98501
email: w.hillis@worldnet.att.net
I've been working on this for six hours, but I'm really lame at Perl and can't get it right. What I've done is only manage to change all the rows one color or the other. I'm pretty sure the solution involves creating an array with a looping routine within either html_record or the other subs.
Here's what I have so far (wincing from embarrassment):
In sub html_view_success (and similarly in sub html_delete_form, and sub html_modify_form),
tried this in the rec_count loop (red is new):
$rec_count = 1;
$odd = "#F0FFF0";
$even = "#FFFFFF";
$bgcol = $even;
@bgcols = [0];
print qq|
<table width="758" cellpadding="7" cellspacing="0" border="0">
<tr>
<td><img src="/images/shim.gif" width="1" height="1" vspace="0" hspace="68" border="0"></td>
<td><img src="/images/shim.gif" width="1" height="1" vspace="0" hspace="296" border="0"></td>
</tr> |;
for (0 .. $numhits - 1) {
if ($bgcol==$even) { #if the last row was honeydew
$bgcol=$odd #make the next one white
} else { #if the last one was white
$bgcol=$even #make the next one honeydew
}
push(@bgcols,$bgcol);
print qq|
<tr>
<td> </td>|;
&html_record (&array_to_hash($_, @hits, @bgcols));
print "</tr>";
++$rec_count;
}
In sub html_record, changed 'print "<td>" to this:
print "<td bgcolor=$bgcol>";
ANY help is welcome. TIA!
William
William Hillis
4411 Governor Ln SE
Olympia, WA 98501
email: w.hillis@worldnet.att.net