Gossamer Forum
Home : Products : DBMan : Customization :

Newbie Code Question

Quote Reply
Newbie Code Question
I hope this is in the right place. Couldn't decide if it should go here or on the discussion board, but here goes:

I have tried to modify the code for the html_record to have 2 columns of checkboxes instead of just down one straight line. Now I can get the code working fine in the html_record_form, but in the html_record area, the code brings me an internal error. I am assuming it has something to do with the
Code:
}
print qq||;
if ($rec{'URL'}) {
print qq|
|;
lines, maybe being in the wrong place, but i'm not sure. Does that bit of code have to go in between table rows instead of the <TD> tags? I was wondering if someone could take a look at it and let me know if that is the problem or what I can do to fix it. This is the only way I know of how to get 2 columns. Thanks! Smile

Here is the text version of the html_record area that I saved:

http://www.wdu.net/html_test.txt
Quote Reply
Re: [wdu2002] Newbie Code Question In reply to
Code:

if ($rec{'Nearby Attractions'}) {
print qq|
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>Nearby Attractions:</FONT></TD>
<TD WIDTH="80%">&nbsp;<$font>$rec{'Nearby Attractions'}</Font></TD></TR>
|;

<TR>
<TD ALIGN="MIDDLE" COLSPAN="2">

<TABLE BORDER="0" WIDTH="450" CELLPADDING="0" CELLSPACING="0">
<TR>
}
mmove |; to place above }
Love you all,and thank for all help here ,this is a greatest forum.
Act.
Quote Reply
Re: [wdu2002] Newbie Code Question In reply to
There are a few places where some code was missing.

You can also greatly condense the codes to make the pages load quicker. The configurator is excellent but does add extra coding here and there. I've attached a revised version of your layout to include the 2 columns with much less coding.

Hope this helps



Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] Newbie Code Question In reply to
Lois, thank you VERY much! It condensed that alot! LOL But one small problem...on the view records, none of my checkboxes are showing up now. Crazy

Let me see if I can post the link to the view records:
http://www.wdu.net/...w_records=1&ID=*

The bottom 2 records are the ones that I just added after I uploaded the new html.pl file, but its just a blank table. Was there something missing?
Quote Reply
Re: [wdu2002] Newbie Code Question In reply to
Sorry for the delayed response. I'm not sure why the fields would show up for one record and not the others.

Each checkbox is a field defined in your .cfg file correct?
In your html_record_form do you have the checkboxes setup like the following example?

|; print &build_checkbox_field("Cable TV",$rec{'Cable TV'}); print qq|

P.S. You can also add commas or <BR> tags between the selections for the ouput.





Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] Newbie Code Question In reply to
I double checked the html_record_form subroutine and that's how the checkboxes are setup and I have them each in a separate field in the .cfg file. But aside from this problem, now I have another. I tried to re-edit the code in the html.pl file with 2 mods. One for file uploads and one for the short/long display, so now not only do I have the problem of the checkboxes not showing up, but now I cannot even access the script and I get a DBMan has encountered an internal error code. So i'm really hoping some kind soul can help me out here! Angelic I'm so lost now that I dont even know where to begin to troubleshoot! LOL

Here's the html.pl file that I saved as a text file to view.
http://www.wdu.net/WDU.TXT

Thanks a million to anyone that can help. Angelic
Quote Reply
Re: [wdu2002] Newbie Code Question In reply to
Right away I noticed where you have the codes for the image upload you are missing some necessary closing print codes:

Where you are displaying the image you only need to add the code once.

Here is what you have:

<TD ALIGN="Middle" VALIGN="TOP" WIDTH="100%">
if (-e "$SAVE_DIRECTORY/$rec{$db_key}") {
opendir (GRAPHIC, "$SAVE_DIRECTORY/$rec{$db_key}") or &cgierr("unable to open directory: $SAVE_DIRECTORY/$rec{$db_key}. Reason: $!");
@files = readdir(GRAPHIC);
closedir (GRAPHIC);
foreach $file (@files) {
next if ($file =~ /^\./); # Skip "." and ".." entries..
next if ($file =~ /^index/); # Skip index.htm type files..
print qq|<img src= "$SAVE_DIRECTORY_URL/$rec{$db_key}/$file">|;
}
}
&nbsp;
if (-e "$SAVE_DIRECTORY/$rec{$db_key}") {
opendir (GRAPHIC, "$SAVE_DIRECTORY/$rec{$db_key}") or &cgierr("unable to open directory: $SAVE_DIRECTORY/$rec{$db_key}. Reason: $!");
@files = readdir(GRAPHIC);
closedir (GRAPHIC);
foreach $file (@files) {
next if ($file =~ /^\./); # Skip "." and ".." entries..
next if ($file =~ /^index/); # Skip index.htm type files..
print qq|<img src= "$SAVE_DIRECTORY_URL/$rec{$db_key}/$file">|;
}
}
</TD>

Try changing to:

<TD ALIGN="Middle" VALIGN="TOP" WIDTH="100%"> |;

if (-e "$SAVE_DIRECTORY/$rec{$db_key}") {
opendir (GRAPHIC, "$SAVE_DIRECTORY/$rec{$db_key}") or &cgierr("unable to open directory: $SAVE_DIRECTORY/$rec{$db_key}. Reason: $!");
@files = readdir(GRAPHIC);
closedir (GRAPHIC);
foreach $file (@files) {
next if ($file =~ /^\./); # Skip "." and ".." entries..
next if ($file =~ /^index/); # Skip index.htm type files..
print qq|<img src= "$SAVE_DIRECTORY_URL/$rec{$db_key}/$file">|;
}
}
print qq| </TD>

Notice the closing print tag before the code and then the print qq| when you once again start your table tags.

There is a great little snippet of code in the FAQ noted below under "Troubleshooting" called 'Getting useful error messages' or something like that. I would highly suggest adding that to your files as it will pinpoint errors like this very easily for you. It has saved me hours of troubleshooting time :)



Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/