Gossamer Forum
Home : Products : DBMan : Customization :

Newbie Question

Quote Reply
Newbie Question
Ok, I'm not very knowledgeable in the programming lingo, so if you are kind enough to provide an answer, please keep it "dumbed down" :) I currently have JPDeni's Short/Long user friendly script working, I was just wondering how to add color to the table heads. Everything I try that would work in normal HTML seems to mess the program up.

heres the
sub html_view_success {
# --------------------------------------------------------
# This page displays the results of a successful search.
# You can use the following variables when displaying your
# results:
#
# $numhits - the number of hits in this batch of results.
# $maxhits - the max number of hits displayed.
# $db_total_hits - the total number of hits.
# $db_next_hits - html for displaying the next set of results.
#

my (@hits) = @_;
my ($numhits) = ($#hits+1) / ($#db_cols+1);
my ($maxhits); $in{'mh'} ? ($maxhits = $in{'mh'}) : ($maxhits = $db_max_hits);
$in{'nh'} ? ($nh = $in{'nh'}) : ($nh = 1);

$page_title = "Search Results";
&html_page_top;

# Go through each hit and convert the array to hash and send to
# html_record for printing.
if (($db_total_hits == 1) || ($maxhits == 1)) {
&html_record_long(&array_to_hash(0, @hits));
}

else {
print qq|<p><$font>Your search returned <b>$db_total_hits</b> matches.</font>|;
if ($db_next_hits) { print "<br><$font>Pages: $db_next_hits</font>"; }
$i = 1;
print "<CENTER><TABLE border=1 cellspacing=2 cellpadding=1>\n";
print qq|<tr bgcolor="$row_color[$color]">|;
print "<TR><TD><$font>ID #</font></TD><TD><$font>Show Name</font></TD>\n";
print "<TD><$font>Held on</font></TD>\n";
print "<TD><$font>Show Grounds</font></TD>\n";
print "<TD><$font>Run By</font></TD>\n";
print "<TD><$font>Type</font></TD></TR>\n";
print "<CENTER>";
for (0 .. $numhits - 1) {

print "<tr>";
&html_record (&array_to_hash($_, @hits));
print "</tr>";
++$i;
}
print "</table>";
if ($db_next_hits) { print "<br><$font>Pages: $db_next_hits</font>";}
}
&html_footer;
&html_page_bottom;

}
---------------------

If you could offer any kind of help that would be great :)
Quote Reply
Re: [MistyGirl] Newbie Question In reply to
Perhaps the problem is with quotes.

Here is your dumbed down explaination with examples, however, this might not be the problem.

the following line uses a double quote as part of the Perl code, so if you added a html code like border="1" (with quotes), yes it would mess-up the Perl code.

print "<CENTER><TABLE border=1 cellspacing=2 cellpadding=1>\n";

************
Now the line below, you can add quoted html commands, as the Perl code is looking for a | (pipe) to know where the print command ends.

print qq|<tr bgcolor="$row_color[$color]">|;

So ............. try using

print qq|

instead of

print "

or don't use the quotes in your html commands.

Well maybe that's not the problem anyway, let me know.

Smile
Quote Reply
Re: [joematt] Newbie Question In reply to
I feel silly now...thanks so much joematt :)