I saw in the various threads how to alternate the colors of the spreadsheet mod.
Question: How do
I color the header row using a variable in the cfg file instead of hard coding the html.pl file?
Here is the code for coloring via hard codeing html.pl
# of the field that is associated with that header -- in both places within each line.
print qq|
<TABLE border="1"><TR bgcolor="#00CC00"><TD><a href="$db_script_url?$new_url&sb=1&so=$so[1]">Products</a></TD>
<TD><a href="$db_script_url?$new_url&sb=2&so=$so[2]">Manufacturer</a></TD>
<TD><a href="$db_script_url?$new_url&sb=3&so=$so[3]">Website</a></TD></TR>\n|; for (0 .. $numhits - 1) {
$color = !$color;
print qq|<tr bgcolor="$row_color[$color]">|;
&html_record (&array_to_hash($_, @hits));
print "</tr>";
++$rec_count;
}
I have setup a variable in the default.cfg file like this,
# Spreadsheet Mod Alternate Row Color change settings
$row_color[0] = '#FFFFFF';
$row_color[1] = '#009000';
$row_color_header = '00CC00';
I added this
<TD><a href="$db_script_url?$new_url&sb=2&so=$so[2]">Manufacturer</a></TD>
<TD><a href="$db_script_url?$new_url&sb=3&so=$so[3]">Website</a></TD></TR>\n|;
But it didn't work. What am I missing?
Ed
Question: How do
I color the header row using a variable in the cfg file instead of hard coding the html.pl file?
Here is the code for coloring via hard codeing html.pl
Code:
# Note: In each of the header cells, replace # with the field number # of the field that is associated with that header -- in both places within each line.
print qq|
<TABLE border="1"><TR bgcolor="#00CC00"><TD><a href="$db_script_url?$new_url&sb=1&so=$so[1]">Products</a></TD>
<TD><a href="$db_script_url?$new_url&sb=2&so=$so[2]">Manufacturer</a></TD>
<TD><a href="$db_script_url?$new_url&sb=3&so=$so[3]">Website</a></TD></TR>\n|; for (0 .. $numhits - 1) {
$color = !$color;
print qq|<tr bgcolor="$row_color[$color]">|;
&html_record (&array_to_hash($_, @hits));
print "</tr>";
++$rec_count;
}
I have setup a variable in the default.cfg file like this,
Code:
# =========================================================================== # Spreadsheet Mod Alternate Row Color change settings
$row_color[0] = '#FFFFFF';
$row_color[1] = '#009000';
$row_color_header = '00CC00';
I added this
Code:
<TABLE border="1"><TR bgcolor="$row_color"><TD><a href="$db_script_url?$new_url&sb=1&so=$so[1]">Products</a></TD> <TD><a href="$db_script_url?$new_url&sb=2&so=$so[2]">Manufacturer</a></TD>
<TD><a href="$db_script_url?$new_url&sb=3&so=$so[3]">Website</a></TD></TR>\n|;
But it didn't work. What am I missing?
Ed