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?
Jun 30, 1999, 9:19 PM
Veteran / Moderator (8669 posts)
Jun 30, 1999, 9:19 PM
Post #2 of 15
Views: 5515
Jul 1, 1999, 11:07 AM
Veteran / Moderator (8669 posts)
Jul 1, 1999, 11:07 AM
Post #6 of 15
Views: 5522
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
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
Jul 1, 1999, 11:23 AM
Novice (10 posts)
Jul 1, 1999, 11:23 AM
Post #7 of 15
Views: 5479
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
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
Jul 1, 1999, 3:06 PM
Veteran / Moderator (8669 posts)
Jul 1, 1999, 3:06 PM
Post #8 of 15
Views: 5441
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!
------------------
JPD
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!
------------------
JPD
Jul 1, 1999, 9:36 PM
Veteran / Moderator (8669 posts)
Jul 1, 1999, 9:36 PM
Post #9 of 15
Views: 5448
I see your problem with your subroutine. You're missing a closing brace.
# -------------------------------------
# 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:
#-------------------------------------
# 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.
for (0 .. $numhits - 1) {
&html_record (&array_to_hash($_, @hits));
}
print "</table>";
------------------
JPD
[This message has been edited by JPDeni (edited July 02, 1999).]
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).]
Jul 2, 1999, 6:12 AM
Novice (10 posts)
Jul 2, 1999, 6:12 AM
Post #11 of 15
Views: 5480
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
Thanks, Ken
Jul 2, 1999, 8:25 AM
Veteran / Moderator (8669 posts)
Jul 2, 1999, 8:25 AM
Post #12 of 15
Views: 5516
Jul 2, 1999, 8:53 AM
Novice (10 posts)
Jul 2, 1999, 8:53 AM
Post #13 of 15
Views: 5441
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
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
Jul 2, 1999, 6:07 PM
Veteran / Moderator (8669 posts)
Jul 2, 1999, 6:07 PM
Post #15 of 15
Views: 5481
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
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