Gossamer Forum
Home : Products : DBMan : Installation :

Default graphic not always showing on record display

Quote Reply
Default graphic not always showing on record display
When I do a view of my database records, if there is more than 1 page of records to be displayed, the records that used the default graphic (i.e., did not upload a graphic during the add process) do not show up with their default graphic.

If I have only 1 page of records to display, it works fine.

The only place I print the graphics is in HTML_RECORD_FORM:

print qq|
<TABLE WIDTH="475" CELLPADDING=0 CELLSPACING=0 BORDER=1 BGCOLOR="#99ccff">
<TR> <TD Align="RIGHT" VALIGN="TOP" WIDTH="150">

|;
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" width=150 height=100>|;
$graphic_found=1;
}
}
unless ($graphic_found) {
print qq|
<img src="http://server.walkermls.info/uploads/nophoto.jpg" width=150 height=100>|;
}

Do I need to put this code somewhere else too for multiple page displays?
Quote Reply
Re: [smithT] Default graphic not always showing on record display In reply to
This isn't the problem but I just spotted something incorrect...

>> if ($file =~ /^$file_test/) { <<

You need:

if ($file =~ /^\Q$file_test\E/) {

...otherwise perl thinks $ is a meta-character in the regex and not a scalar.

Last edited by:

RedRum: Dec 22, 2001, 8:48 AM
Quote Reply
Re: [smithT] Default graphic not always showing on record display In reply to
There are some updates/changes to many of the mods. It's always a good idea when using a new mod to check the FAQ noted below or search within the forum for related threads to see if any changes were posted after they listed.

In the portion of the script you posted above you need to change from:

$file_test = $rec{$db_key} . ".";
foreach $file (@files) {
if ($file =~ /^$file_test/) {

to:

$file_test = $rec{$db_key};
foreach $file (@files) {
if ($file =~ /^$file_test\./) {

You may want to check the FAQ for further updates to this mod.



Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] Default graphic not always showing on record display In reply to
 
You need \Q \E unless you want irregular regex.

Last edited by:

RedRum: Dec 22, 2001, 6:51 PM