Gossamer Forum
Home : Products : DBMan : Installation :

What's wrong with this?

Quote Reply
What's wrong with this?
Hi all, I've no idea what I'm doing. I've used JPD's auto configure to create my database, there seems to be a problem when I try to paste the new code into the html.pl file. I get an internal server error, would be very grateful if anyone can point out what's wrong with this. Thanks in advance.


# Copy the subroutines below and use them as replacements for sub html_record form and
# sub html_record in your html.pl file
#

##########################################################
## Record Layout ##
##########################################################

sub html_record_form {
# --------------------------------------------------------
# The form fields that will be displayed each time a record is
# edited (including searching). You don't want to put the
# <FORM> and </FORM tags, merely the <INPUT> tags for each field.
# The values to be displayed are in %rec and should be incorporated
# into your form. You can use &build_select_field, &build_checkbox_field
# and &build_radio_field to generate the respective input boxes. Text and
# Textarea inputs can be inserted as is. If you turn on form auto
# generation, the program will build the forms for you (all though they may
# not be as nice). See the README for more info.

my (%rec) = @_;
($db_auto_generate and print &build_html_record_form(%rec) and return);

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

print qq|
<TABLE WIDTH="450" CELLPADDING=0 CELLSPACING=0 BORDER=1 BGCOLOR="#FFFFCC">
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="150"><$font_color>Name:</FONT></TD>
<TD VALIGN="TOP" WIDTH="475">&nbsp;<INPUT TYPE="TEXT" NAME="Name" SIZE="20" VALUE="$rec{'Name'}" MAXLENGTH="255"></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="150"><$font_color>Main/Alt:</FONT></TD>
<TD VALIGN="TOP" WIDTH="475">&nbsp;|; print &build_select_field("Main/Alt",$rec{'Main/Alt'}); print qq|</TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="150"><$font_color>Class:</FONT></TD>
<TD VALIGN="TOP" WIDTH="475">&nbsp;<INPUT TYPE="TEXT" NAME="Class" SIZE="20" VALUE="$rec{'Class'}" MAXLENGTH="255"></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="150"><$font_color>Level:</FONT></TD>
<TD VALIGN="TOP" WIDTH="475">&nbsp;<INPUT TYPE="TEXT" NAME="Level" SIZE="20" VALUE="$rec{'Level'}" MAXLENGTH="255"></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="150"><$font_color>Time Zone:</FONT></TD>
<TD VALIGN="TOP" WIDTH="475">&nbsp;<INPUT TYPE="TEXT" NAME="Time Zone" SIZE="20" VALUE="$rec{'Time Zone'}" MAXLENGTH="255"></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="150"><$font_color>Rank:</FONT></TD>
<TD VALIGN="TOP" WIDTH="475">&nbsp;<INPUT TYPE="TEXT" NAME="Rank" SIZE="20" VALUE="$rec{'Rank'}" MAXLENGTH="255"></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="150"><$font_color>Alt Owner:</FONT></TD>
<TD VALIGN="TOP" WIDTH="475">&nbsp;<INPUT TYPE="TEXT" NAME="Alt Owner" SIZE="20" VALUE="$rec{'Alt Owner'}" MAXLENGTH="255"></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="150"><$font_color>Magelo Link:</FONT></TD>
<TD VALIGN="TOP" WIDTH="475">&nbsp;<INPUT TYPE="TEXT" NAME="Magelo Link" SIZE="20" VALUE="$rec{'Magelo Link'}" MAXLENGTH="255"></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="150"><$font_color>E-mail:</FONT></TD>
<TD VALIGN="TOP" WIDTH="475">&nbsp;<INPUT TYPE="TEXT" NAME="E-mail" SIZE="20" VALUE="$rec{'E-mail'}" MAXLENGTH="255"></TD></TR>
</TABLE>
|;
}

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) = @_; # Load any defaults to put in the VALUE field.
($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';

$url{'Magelo Link'} = $rec{'Magelo Link'};
$url{'Magelo Link'} =~ s/<\/?B>//g;
$url{'E-mail'} = $rec{'E-mail'};
$url{'E-mail'} =~ s/<\/?B>//g;

print qq|
<TABLE WIDTH="475" CELLPADDING=0 CELLSPACING=0 BORDER=1 BGCOLOR="#FFFFCC">
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>Name:</FONT></TD>
<TD WIDTH="80%">&nbsp;<$font>$rec{'Name'}</Font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>Main/Alt:</FONT></TD>
<TD WIDTH="80%">&nbsp;<$font>$rec{'Main/Alt'}</Font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>Class:</FONT></TD>
<TD WIDTH="80%">&nbsp;<$font>$rec{'Class'}</Font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>Level:</FONT></TD>
<TD WIDTH="80%">&nbsp;<$font>$rec{'Level'}</Font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>Time Zone:</FONT></TD>
<TD WIDTH="80%">&nbsp;<$font>$rec{'Time Zone'}</Font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>Rank:</FONT></TD>
<TD WIDTH="80%">&nbsp;<$font>$rec{'Rank'}</Font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>Alt Owner:</FONT></TD>
<TD WIDTH="80%">&nbsp;<$font>$rec{'Alt Owner'}</Font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>Magelo Link:</FONT></TD>
<TD WIDTH="80%">&nbsp;<$font><a href="$url{'Magelo Link'}">$rec{'Magelo Link'}</a>
|;
}
print qq|
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>E-mail:</FONT></TD>
<TD WIDTH="80%">&nbsp;<$font><a href="mailto:$url{'E-mail'}">$rec{'E-mail'}</a>
|;
}
print qq|
</TABLE>
|;
}
Quote Reply
Re: [numinor] What's wrong with this? In reply to
Main/Alt - not sure if the / within the field name would be a problem but you might want to change that to: Main_Alt to be safe.

In your sub html_record you have:


<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>Magelo Link:</FONT></TD>
<TD WIDTH="80%">&nbsp;<$font><a href="$url{'Magelo Link'}">$rec{'Magelo Link'}</a>
|;
}
print qq|
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>E-mail:</FONT></TD>
<TD WIDTH="80%">&nbsp;<$font><a href="mailto:$url{'E-mail'}">$rec{'E-mail'}</a>
|;
}
print qq|
</TABLE>
|;
}

which I would think should be just:


<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>Magelo Link:</FONT></TD>
<TD WIDTH="80%">&nbsp;<$font><a href="$url{'Magelo Link'}">$rec{'Magelo Link'}</a> </TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>E-mail:</FONT></TD>
<TD WIDTH="80%">&nbsp;<$font><a href="mailto:$url{'E-mail'}">$rec{'E-mail'}</a> </TD></TR> </TABLE> |;
}

You were missing some ending </TD></TR> tags and you were closing off the sub too soon.

Hope this helps

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] What's wrong with this? In reply to
Many thanks, will try that.