Gossamer Forum
Home : Products : DBMan : Discussions :

I edited HTML.pl and then this happened...

Quote Reply
I edited HTML.pl and then this happened...
Heya,

I edited the sub html_record part of the html.pl and then when i uploaded it DB Man said it "Encountered an error" or something around those lines. I don't know what is wring because the HTML i added doesn't look bad? Here is what i had before and after.

Before (which works)

sub html_record {
# --------------------------------------------------------
# How a record will be displayed. This is used primarily in
# returning search results and how it is formatted. The record to
# be displayed will be in the %rec hash.

my (%rec) = @_;
$rec{$db_key} =~ s/<.?B>//g;
#($db_auto_generate and print &build_html_record(%rec) and return);

my $font_color = 'Font face="Verdana, Arial, Helvetica" Size=2 Color=#003399';
my $font = 'Font face="Verdana, Arial, Helvetica" Size=2';

print qq|
<TABLE WIDTH="475" CELLPADDING=0 CELLSPACING=0 BORDER=1 BGCOLOR="#FFFFCC">
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>ID:</FONT></TD>
<TD WIDTH="80%"> <$font>$rec{'ID'}</Font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font_color>Title:</FONT></TD>
<TD> <$font>$rec{'Title'}</Font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font_color>URL: </FONT></TD>
<TD> <$font><A HREF="$rec{'URL'}">$rec{'URL'}</A></Font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font_color>Type: </FONT></TD>
<TD> <$font>$rec{'Type'}</Font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font_color>Date:</FONT></TD>
<TD> <$font>$rec{'Date'}</Font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font_color>Category:</FONT></TD>
<TD> <$font>$rec{'Category'}</Font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font_color>Description:</FONT></TD>
<TD> <$font>$rec{'Description'}</Font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font_color>Validated:</FONT></TD>
<TD> <$font>$rec{'Validated'}</Font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font_color>Popular:</FONT></TD>
<TD> <$font>$rec{'Popular'}</Font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font_color>Image:</FONT></TD>
<TD>|; # to close off a previous print qq| statement
opendir (GRAPHIC, "$SAVE_DIRECTORY") or &cgierr("unable to open directory in delete records: $SAVE_DIRECTORY. Reason: $!");
@files = readdir(GRAPHIC);
closedir (GRAPHIC);
$file_test = $rec{$db_key} . ".";
foreach $file (@files) {
if ($file =~ /^$file_test/) {
print qq|<img src= "$SAVE_DIRECTORY_URL/$file">|;
$graphic_found=1;
}
}
print qq|
</TD></TR>
</TABLE>
|;
}




After (doesn't work)

sub html_record {
# --------------------------------------------------------
# How a record will be displayed. This is used primarily in
# returning search results and how it is formatted. The record to
# be displayed will be in the %rec hash.

my (%rec) = @_;
$rec{$db_key} =~ s/<.?B>//g;
($db_auto_generate and print &build_html_record(%rec) and return);

my $font_color = 'Font face="Verdana, Arial, Helvetica" Size=2 Color=#003399';
my $font = 'Font face="Verdana, Arial, Helvetica" Size=2';

print qq|
<table width="480" cellspacing="0" cellpadding="3">
<tr>
<td colspan="3" bgcolor="2689B6" style="border: 1 solid #04254A"><font face="arial" size="2" color="#EFEFEF"><a href="$rec{'Download_Link'}"><b>$rec{'Car_Name'}</b></a>$rec{'ID'}</font></td>
</tr>
<tr>
<td style="border: 1 solid #04254A; border-top: 0" align="center" width="140" bgcolor="C4E3F2" style="border-bottom: 1 solid #04264A; border-right: 1 solid #04264A; border-left: 1 solid #04264A" rowspan="5">|; # to close off a previous print qq| statement
opendir (GRAPHIC, "$SAVE_DIRECTORY") or &cgierr("unable to open directory in delete records: $SAVE_DIRECTORY. Reason: $!");
@files = readdir(GRAPHIC);
closedir (GRAPHIC);
$file_test = $rec{$db_key} . ".";
foreach $file (@files) {
if ($file =~ /^$file_test/) {
print qq|<a href="$SAVE_DIRECTORY_URL/$file"><img src= "$SAVE_DIRECTORY_URL/$file" width="140" height="100" style="border: 1 solid #04254A"></a>|;
$graphic_found=1;
}
}
print qq|</td>
<td width="80" bgcolor="#C4E3F2" style="border: 1 solid #04254A; border-top: 0; border-left: 0; border-right: 0" align="right"><font face="verdana" size="1" color="04254A">Author: </font></td>
<td width="290" bgcolor="C4E3F2" style="border: 1 solid #04254A; border-top: 0; border-left: 0"><font face="verdana" size="1" color="04254A"><a href="mailto:$rec{'Author_Email'}">$rec{'Author'}</a></font></td>
</tr>
<tr>
<td width="80" bgcolor="#C4E3F2" style="border: 1 solid #04254A; border-top: 0; border-left: 0; border-right: 0" align="right"><font face="verdana" size="1" color="04254A">File Size: </font></td>
<td width="290" bgcolor="C4E3F2" style="border: 1 solid #04254A; border-top: 0; border-left: 0"><font face="verdana" size="1" color="04254A">$rec{'File_Size'} kb</font></td>
</tr>
<tr>
<td width="80" bgcolor="#C4E3F2" style="border: 1 solid #04254A; border-top: 0; border-left: 0; border-right: 0" align="right"><font face="verdana" size="1" color="04254A">Dash: </font></td>
<td width="290" bgcolor="C4E3F2" style="border-right: 1 solid #04254A; border-bottom: 1 solid #04254A"><font face="verdana" size="1" color="04254A">$rec{'Dash'}</font></td>
</tr>
<tr>
<td width="80" bgcolor="#C4E3F2" style="border: 1 solid #04254A; border-top: 0; border-left: 0; border-right: 0" align="right"><font face="verdana" size="1" color="04254A">Status: </font></td>
<td width="290" bgcolor="C4E3F2" style="border: 1 solid #04254A; border-top: 0; border-left: 0"><font face="verdana" size="1" color="04254A">$rec{'Status'}</font></td>
</tr>
<tr>
<td width="80" bgcolor="#C4E3F2" style="border: 1 solid #04254A; border-top: 0; border-left: 0; border-right: 0" align="right"><font face="verdana" size="1" color="04254A">Review/Rating: </font></td>
<td width="290" bgcolor="C4E3F2" style="border: 1 solid #04254A; border-top: 0; border-left: 0"><font face="verdana" size="1" color="04254A"><a href="javascript:rating('http://eg.rgnetwork.com/php-bin/review/rateme2.cgi?ratetopic=$rec{'Topic_Number'}&category=$rec{'Category_Number'}')">Rate Car</a> | <a href="javascript:review('http://eg.rgnetwork.com/php-bin/review/rateme2.cgi?reviewtopic=$rec{'Topic_Number'}')">Review Car</a> | <a href="javascript:viewreview('http://eg.rgnetwork.com/php-bin/review/rateme2.cgi?viewtopic=$rec{'Topic_Number'}&category=$rec{'Category_Number'}')">View Ratings/Reviews</a></font></td>
</tr>
<tr>
<td colspan="3" bgcolor="C4E3f" style="border: 1 solid #04254A; border-top: 0"><font face="verdana" size="1" color="04254A">$rec{'Comments'}</font></td>
</tr>
</table>
|;
}



Thanx in advance..
R. Hawkes

P.S. I have edited the DataBase definition bit in the default.cfg file but i know that works

Also sorry i posted in two forums but i didn't know which one to post in :(

Quote Reply
Re: I edited HTML.pl and then this happened... In reply to
The problem lies in this section:

<td width="80" bgcolor="#C4E3F2" style="border: 1 solid #04254A; border-top: 0; border-left: 0; border-right: 0" align="right"><font face="verdana" size="1" color="04254A">Review/Rating: </font></td>
<td width="290" bgcolor="C4E3F2" style="border: 1 solid #04254A; border-top: 0; border-left: 0"><font face="verdana" size="1" color="04254A"><a href="javascript:rating('http://eg.rgnetwork.com/php-bin/review/rateme2.cgi?ratetopic=$rec{'Topic_Number'}&category=$rec{'Category_Number'}')">Rate Car</a> | <a href="javascript:review('http://eg.rgnetwork.com/php-bin/review/rateme2.cgi?reviewtopic=$rec{'Topic_Number'}')">Review Car</a> | <a href="javascript:viewreview('http://eg.rgnetwork.com/php-bin/review/rateme2.cgi?viewtopic=$rec{'Topic_Number'}&category=$rec{'Category_Number'}')">View Ratings/Reviews</a></font></td>


Becasue you started the HTML with a print qq|, perl treats the first | it comes across as a "stop printing" marker.

You will need to escape any pipes you wish to print to the screen, eg: \|

- Mark


Astro-Boy!!
http://www.zip.com.au/~astroboy/
Quote Reply
Re: I edited HTML.pl and then this happened... In reply to
Or an easier solution would be to change print qq| |; to print qq~ ~;

Installations:http://www.wiredon.net/gt/
Favicon:http://www.wiredon.net/favicon/