Gossamer Forum
Home : Products : DBMan : Customization :

Using default value of http:// but not display if blank

Quote Reply
Using default value of http:// but not display if blank
At http://redundantcartridge.com/dbman/text/dbfaq8.txt I found

"Using default value of http:// but not display if blank"

If it's just the URL field alone use:
|;
if (length($rec{'URL'}) > 7) {
print qq|<a href="$rec{'URL'}">$rec{'URL'}</a> |;
}
print qq|

So instead of
if ($rec{'Hjemmeside'}) {
print qq|
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>Hjemmeside:</FONT></TD>
<TD WIDTH="80%">&nbsp;<$font><a href="$url{'Hjemmeside'}">$rec{'Hjemmeside'}</a>
|;
}

I used
if (length($rec{'Hjemmeside'}) > 7) {
print qq|<a href="$rec{'Hjemmeside'}">$rec{'Hjemmeside'}</a> |;
print qq|
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>Hjemmeside:</FONT></TD>
<TD WIDTH="80%">&nbsp;<$font><a href="$url{'Hjemmeside'}">$rec{'Hjemmeside'}</a>
|;
}
(Hjemmeside is norwegian for Homepage)

This resulted in the URL getting printed both in the field for email (Epost) and the field for URL (Hjemmeside) and in one instance on top over the table.

This is viewable at www.nicklisten.no/cgi-bin/dbman/db.cgi. You can log on as test/test. See ID 6 and 7.

The question is: How do I fix this?

My files can be found at:
www.nicklisten.no/files/db_pl.txt
www.nicklisten.no/files/default_cfg.txt
www.nicklisten.no/files/html_pl.txt

Jan Peter
Quote Reply
Re: [JPWiese] Using default value of http:// but not display if blank In reply to
I see some problems with not ending the table cell tags </TD></TR> such as:

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

if ($rec{'Epost2'}) {
print qq|
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>Epost:</FONT></TD>
<TD WIDTH="80%">&nbsp;<$font><a href="mailto:$url{'Epost2'}">$rec{'Epost2'}</a>
|;

TRY CHANGING:

if (length($rec{'Hjemmeside'}) > 7) {
print qq|<a href="$rec{'Hjemmeside'}">$rec{'Hjemmeside'}</a> |;

print qq|

<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>Hjemmeside:</FONT></TD>
<TD WIDTH="80%">&nbsp;<$font><a href="$url{'Hjemmeside'}">$rec{'Hjemmeside'}</a>
|;

TO:

if (length($rec{'Hjemmeside'}) > 7) {
print qq|<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>Hjemmeside:</FONT></TD>
<TD WIDTH="80%">&nbsp;<$font><a href="$url{'Hjemmeside'}">$rec{'Hjemmeside'}</a></TD></TR>
|;

I think add the ending </TD></TR> where missing and changing the Hjemmeside to within table tags should help solve your problem. If not, let us know.

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] Using default value of http:// but not display if blank In reply to
This worked great, Thank you!

Jan Peter