Gossamer Forum
Home : Products : DBMan : Customization :

putting borders around record info

Quote Reply
putting borders around record info
My next question is where in html.pl do you change the border attribute to have borders around the record information in a database. I have changed all the border=0 tags to border=1 in this script, yet when I view all, there are no borders around the info. Where do I need to make this change?
Quote Reply
Re: putting borders around record info In reply to
I would do a search for <table and make sure that every one is followed by border=1. All of the html that is generated by the script is in the html.pl file.

------------------
JPD





Quote Reply
Re: putting borders around record info In reply to
Hi, well I downloaded the new html.pl, looked at all table border tags, changed them all to 1, and still I don't get borders around the info, so I don't know what to do at this point.
Quote Reply
Re: putting borders around record info In reply to
Is your database available on the web so I can see it?


------------------
JPD





Quote Reply
Re: putting borders around record info In reply to


[This message has been edited by texasreddog (edited July 01, 1999).]

[This message has been edited by JPDeni (edited July 01, 1999).]
Quote Reply
Re: putting borders around record info In reply to
Now I see the problem. I always forget to ask if people are using autogenerate, because most people don't. Sorry.

Open up your db.cgi script and look for sub build_html_record. Change the line

$output = "<p><table border=0 width=450>";

to

$output = "<p><table border=1 width=450>";

If you want borders on the table with the forms, make a similar change in sub build_html_record_form, just below the build_html_record.

------------------
JPD





Quote Reply
Re: putting borders around record info In reply to
JPD, is this possible?

My superior wants to have the data layed out like this:

Name Address Home_Phone Cell_Phone ...

Robert Austin yadda
Kevin yadda
Amy yadda

Is it possible to change something in one of the programs, so that the headers print once at the top, then all the records are layed out horizontally, instead of vertically?
Thanks again,

Ken
Quote Reply
Re: putting borders around record info In reply to
You will need to edit sub html_record in the html.pl file and set $db_auto_generate to 0. (You can get sneaky and autogenerate the form but not the display if you want to.)

Take a look at sub html_record and see if you can work out how to do it. I'll be glad to help with anything you don't understand.

I probably won't be back on until late tonight or tomorrow morning, though. I have to go make dinner soon and tonight has good television! Smile

------------------
JPD





Quote Reply
Re: putting borders around record info In reply to
I see your problem with your subroutine. You're missing a closing brace.

Code:
sub build_headers {
# -------------------------------------
# Builds record headers based on the config information.

my ($output, $field);

$output = "<p><table border=1 width=450><tr>";
foreach $field (@db_cols) {
next if ($db_form_len{$field} == -1);
$output .= qq~<td align=right valign=top><$font>$field:</font></td>~;
}
$output .= "</tr>";
return $output;
}

Your modification of build_html_record won't give you want you want, I don't think.

Try this:

Code:
sub build_html_record {
#-------------------------------------
# Builds a record based on the config information.

my (%rec) = @_;
my ($output, $field);

$output = "<tr>";
foreach $field (@db_cols) {
next if ($db_form_len{$field} == -1);
$output .= qq~<td align=right valign=top><$font>$rec{$field}</font></td>~;
}
$output .= "</tr>\n";
return $output;
}

You can't close off the table in build_html_record if you want the subsequent records to be in the table. From what you said, you want each record to be in a table row. Also, you might notice that I took out the "width" tags. It is better to let the table "seek its own" width in this situation. And you don't need the %rec hash to be passed to your build_headers subroutine, because you don't use it.

You'll need to change sub html_view_success in your html.pl file.

Code:
print &build_headers;
for (0 .. $numhits - 1) {
&html_record (&array_to_hash($_, @hits));
}
print "</table>";


------------------
JPD



[This message has been edited by JPDeni (edited July 02, 1999).]
Quote Reply
Re: putting borders around record info In reply to
JPD, I tried editing db.cgi to make this work, but all in all, it is too much trouble to change this around. I'm just going to leave it in its original form.
Thanks for all your help.
Ken

[This message has been edited by texasreddog (edited July 02, 1999).]
Quote Reply
Re: putting borders around record info In reply to
JPD, if I wanted to add a subroutine called build_headers, which would just print the headers of every record just one time at the top, where would I define and put this. I assume I put the subroutine in db.cgi, but when I execute it, and call it from html.pl, it says it is undefined. So where do I define it. It would be just like build_html_record, just execute one time at the top, then build_html_record would take over.
Thanks, Ken
Quote Reply
Re: putting borders around record info In reply to
I would have to see the subroutine to be able to tell you. My guess is that there is a problem with the writing of the subroutine and not with the placement of it.


------------------
JPD





Quote Reply
Re: putting borders around record info In reply to
As you can see, the headers should execute only once, starting the HTML table, and making one row at the top with the headers...


sub build_headers {
# -------------------------------------
# Builds record headers based on the config information.

my (%rec) = @_;
my ($output, $field);

$output = "<p><table border=1 width=450><tr>";
foreach $field (@db_cols) {
next if ($db_form_len{$field} == -1);
$output .= qq~<td align=rightvalign=top width=20%><$font>$f
ield:</font></td>~;
$output = "</tr>";
return $output;
}

Then, build_html_record takes over, making one row at a time with all the data, until
the end of the query is reached:


sub build_html_record {
#-------------------------------------
# Builds a record based on the config information.

my (%rec) = @_;
my ($output, $field);

foreach $field (@db_cols) {
next if ($db_form_len{$field} == -1);
$output .= qq~<tr><td align=right valign=top width=80%><$font>$rec{$field}</font></td></tr>~;
}
$output .= "</table></p>\n";
return $output;
}

So is this possible to work in db.cgi? And where would I put this, and make calls to it correctly?

Ken
Quote Reply
Re: putting borders around record info In reply to
I went ahead and put in the code tips from you, but when I run it, everything is run together, with no headers or borders.


Erase this when you are done!!!
Thanks, Ken


[This message has been edited by JPDeni (edited July 02, 1999).]
Quote Reply
Re: putting borders around record info In reply to
Try it again. I just saw some errors in the code, which I fixed.

One was in sub build_headers. The line was

$output = "</tr>";

and I changed it to

$output .= "</tr>";

The other one was in sub build_html_record. The original was

$output = "<tr>

and I changed it to

$output = "<tr>";

Those little things can make a big difference. Sorry I didn't catch them before.


------------------
JPD