Gossamer Forum
Home : Products : DBMan : Customization :

Single header output issues

Quote Reply
Single header output issues
ok i have db running and everything is working smoothly except one thing. when i installed and used the custom script from http://www.gossamer-threads.com/...gle%20header;#117232 for the Single Header table it works fine but for some reason it doesnt show the 1st record of the db. so if i have 10 items it only shows 9 on the table? why is it hiding it. and if i lets say want to only see 1 record, it doesnt display anything at all! why is that?

Here is the examples
list all http://www.egidiosimonelli.com/...w_records=1&ID=*


only one record http://www.egidiosimonelli.com/...ecords=1&ID=1009


and this is what my DB looks like
1000|DO NOT DELETE|DO NOT DELETE|XXXX
1001|Galleria Beliar |Caracas, Venezuela|1976
1002|Galeria Radio City |Caracas, Venezuela|1978
1003|Galleria Arte A.Z. |Caracas, Venezuela|1983
1004|Palazzo Frissaco |Tolmezzo, Italy|1995
1005|Galleria Artemisia |Udine, Italy|1996
1006|La Sibilla |Tarquinia, Italy|2002
1007|GAVAC |Viterbo, Italy|Feb. 2003
1008|Associazione Culturale Perseo |Rome, Italy|Jun. 2003
1009|World Fine Art Gallery |New York, U.S.A.|Jul. 2003
1010|Associazione Culturale Perseo |Rome, Italy|Sep. 2003
1011|Morgantown Art Expo|Morgantown WV USA|Nov. 2003

i added the first one with DO NOT DELETE as a dummy entry so that when i used the list all it displayed all the entries i wanted which is fine with me because it technically works but the problem goes further. If i needed to display the list in descending order then it will hide the last record added. So that is why i need to resolve this issue as i want to be able to display the records in descending order so from the last entry to the first one.

can anyone give me any help on this??

here is the code i added on html.pl and db.cgi

added subroutines to html.pl (or in my case exhibitions.pl)
sub html_table_top {
my (%rec) = @_;
print &build_html_table_top(%rec);
return;
}
sub html_table_row {
my (%rec) = @_;
print &build_html_table_row(%rec);
return;
}
sub html_table_bottom {
my (%rec) = @_;
print &build_html_table_bottom(%rec);
return;
}

then replaced
the output for the records in the same file to
print "<P>";
for (0 .. $numhits - 1) {
if ($_ == 0) {
&html_table_top (&array_to_hash($_, @hits));
} else {
&html_table_row (&array_to_hash($_, @hits));
}

and in the db.cgi added
sub build_html_table_top {
# --------------------------------------------------------
# Builds table column header based on the config information.
#
my (%rec) = @_;
my ($output, $field);
$output = "<p><table width=68% border=0 cellpadding=4 cellspacing=0 align=center>";
{
$output .= qq~
<tr bgcolor=1E356C> <td width=40%>
<div align=left><font color=CEE3FD><font size=4 face=Arial, Helvetica, sans-serif>
Event</font></font></div>
</td>
<td width=40%>
<div align=left><font color=CEE3FD><font size=4 face=Arial, Helvetica, sans-serif>Location</font></font></div>
</td>
<td width=20%>
<div align=left><font color=CEE3FD><font size=4 face=Arial, Helvetica, sans-serif>Year</font></font></div>
</td>
~;
}
$output .= "</tr>\n";
return $output;
}
sub build_html_table_row {
# --------------------------------------------------------
# Builds a record based on the config information.
#
my (%rec) = @_;
my ($output);
$output .= "<tr bgcolor=ACCCF0>";
{
$output .= qq~
<td width=40%>
<div align=left><i><b><font color=1E356C>$rec{'Title'}</font></b></i></div>
</td>
<td width=40%>
<div align=left><i><font color=1E356C>$rec{'Location'}</font></i></div>
</td>
<td width=20%>
<div align=left><font color=1E356C>$rec{'Year'}</font></div>
</td>
~;
}
$output .= "</tr>\n";
return $output;
}
sub build_html_table_bottom {
# --------------------------------------------------------
# Finish the search table
#
my (%rec) = @_;
my ($output, $field);
$output = "</tr></table></p>\n";
return $output;
}


I modified it a bit to go along with my color scheme, but it was doing the same thing even before i modified the code shown on the other post
Quote Reply
Re: [TKEP1008] Single header output issues In reply to
The first thing I would check (since when you list all for modify and delete it shows all the records) is to check your .cfg file and see what you have set for:

# Default maximum number of hits returned in a search.
$db_max_hits = 10;

Increase that to a higher number and see if all your records then display. You may need to set it to one more than you actually want displayed for this mod?

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/
Quote Reply
Re: [LoisC] Single header output issues In reply to
looking over the logic for this and i see something that doesn't make sense to me.
Code:

then replaced
the output for the records in the same file to
print "<P>";
for (0 .. $numhits - 1) {
if ($_ == 0) {
&html_table_top (&array_to_hash($_, @hits));
} else {
&html_table_row (&array_to_hash($_, @hits));
}


the first hit (# 0) doesn't build a row; it just builds the column headings. seems to me that the code should be:
Code:

then replaced
the output for the records in the same file to
print "<P>";

&html_table_top (&array_to_hash($_, @hits)); # first print the col headings
for (0 .. $numhits - 1) { # now go thru all the hits

&html_table_row (&array_to_hash($_, @hits)); # and print the rows
}

Quote Reply
Re: [delicia] Single header output issues In reply to
tried your suggestion delicia, but actually got a DBman encounter and error ........

so, i switched it back. but it makes sense if it is that code. i will see what i can do, but if anyone has any suggestions please let me know

Jose
Quote Reply
Re: [TKEP1008] Single header output issues In reply to
try this:
Code:

print "<P>";
for (0 .. $numhits - 1) {
if ($_ == 0) {
&html_table_top (&array_to_hash($_, @hits)); # this just prints the column headings
&html_table_row (&array_to_hash($_, @hits)); # now this prints the first record
} else {
&html_table_row (&array_to_hash($_, @hits)); # this prints the rest of the records
}
Quote Reply
Re: Single header output issues In reply to
After i posted i kept trying and trying until i finally got it, and just recently was looking at all the post i have made, and i had to do exactly what you posted for it to work

For some reason it was eating up the first row, so i made it print the header row twice like you said and VIOLA, it works.

thanks
Wink