Gossamer Forum
Home : Products : DBMan : Customization :

what am i doing wrong here?

(Page 1 of 2)
> >
Quote Reply
what am i doing wrong here?
ok, i got the short/long mod, and on my list all page i have it so you click on the picture to take you to the long results page. anyway, no matter what picture you click on it takes you to the first record, heres the code:

# create link to full display
$record_number = ((($nh - 1) * $db_max_hits) + $rec_count);

$long_url = $ENV{'QUERY_STRING'};
$long_url =~ s/\&nh=\d+//;
$long_url =~ s/\&mh=\d+//;

$long_url = "$db_script_url?$long_url&nh=$record_number&mh=1";

print "<TD>"; # do not remove this! It is necessary to make the records display properly

# Below is where you define what you want to appear for each record in the "short" display.
# You can make this whatever you want, and display as many fields as you would like.
# Choose which of the fields you would like for users to click on to reach the full display
# of records and use that field name in place of "Title" below.
#
# Be sure that you use <a href="$long_url"> for the link to your full record display.

# <-- Start of short display formatting -- >

print qq|


<table border="0" cellspacing="0" cellpadding="0" bgcolor="#CC3333" align="left">
<tr>
<td align="center"><small><font color="#FFFFFF" face="Arial"><strong></strong> <$font>$rec{'Year'} <$font>$rec{'Make'} <$font>$rec{'Model'}</strong></font><div
align="left"><table border="0" cellspacing="1" cellpadding="2" align="center" width="308"
height="105">
<tr>
<td bgcolor="#FFFFFF" width="148" rowspan="6" height="150" valign="middle" checked="false"><p
align="center"> |;
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|<a href="$long_url"><img src= "$SAVE_DIRECTORY_URL/$rec{$db_key}/$file" width="150" height="150" border="0"></a>|;
}
}


print qq|

.
.
.

you get the idea.. see anything wrong?

Quote Reply
Re: what am i doing wrong here? In reply to
I'm having the same problem, but only after I install the Column Display mod...

Quote Reply
Re: what am i doing wrong here? In reply to
same here! i just installed the column mod
i cant figure it out

Quote Reply
Re: what am i doing wrong here? In reply to
# Be sure that you use <a href="$long_url"> for the link to your full record display.

that's what I use ... and it works. I use colored rows is this the same as the column mod ??? or similar.

good luck

**************************************
on the pages in between ...
Quote Reply
Re: what am i doing wrong here? In reply to
i dont think they very similar, the mod i'm using is at http://webmagic.hypermart.net/dbman/view37.txt

it displays the records like this:

Record1 Record2
Record3 Record4

that part works fine.. its the link to the long display that doesnt work. i used the <a href="$long_url"> and everything.. any suggestions?

Quote Reply
Re: what am i doing wrong here? In reply to
i wonder if this from the column mod:

<a href="$db_script_link_url&ww=on&$db_key=$rec{$db_key}&view_records=1">$rec{'Name'}</a>

is conflicting with the short/long link call. ...

this is now beyond me sorry.



**************************************
on the pages in between ...
Quote Reply
Re: what am i doing wrong here? In reply to
thats kinda what i was thinkin'. I have no idea how to fix that. is there anyone here with short/long display and columns? i need to have this workin in 2 days!! hehe

Quote Reply
Re: what am i doing wrong here? In reply to
I still haven't got it working either. Let me know if you do. I've got a client that I'm doing this for. :)
Pdressler
pdressler@mmcable.com


Quote Reply
Re: what am i doing wrong here? In reply to
who made the column mod? JPDeni ???

Ummm post the sub area only .... wonder if more people will comment if they see the code. I don7t think many people use this.
Quote Reply
Re: what am i doing wrong here? In reply to
No this isnt jpdeni's, i tried hers too but the same thing happend.

these are the 2 subs that have to do with the column mod.

sub html_record {
# --------------------------------------------------------
# How a record will be displayed. This is used primarily in
# returning search results and how it is formatted. The record to
# be displayed will be in the %rec hash.
# This is the "short display" -- the list of records that are returned
# from a search.

my (%rec) = @_;
$rec{$db_key} =~ s/<.?B>//g;

### Wherever you want your graphics to print out, use the following:

# create link to full display
$record_number = ((($nh - 1) * $db_max_hits) + $rec_count);

$long_url = $ENV{'QUERY_STRING'};
$long_url =~ s/\&nh=\d+//;
$long_url =~ s/\&mh=\d+//;

$long_url = "$db_script_url?$long_url&nh=$record_number&mh=1";

print "<TD>"; # do not remove this! It is necessary to make the records display properly


# Below is where you define what you want to appear for each record in the "short" display.
# You can make this whatever you want, and display as many fields as you would like.
# Choose which of the fields you would like for users to click on to reach the full display
# of records and use that field name in place of "Title" below.
#
# Be sure that you use <a href="$long_url"> for the link to your full record display.

# <-- Start of short display formatting -- >

print qq|


<table border="0" cellspacing="0" cellpadding="0" bgcolor="#CC3333" align="left">
<tr>
<td align="center"><small><font color="#FFFFFF" face="Arial"><strong></strong> <$font>$rec{'Year'} <$font>$rec{'Make'} <$font>$rec{'Model'}</strong></font><div
align="left"><table border="0" cellspacing="1" cellpadding="2" align="center" width="304"
height="105">
<tr>
<td bgcolor="#FFFFFF" width="148" rowspan="6" height="150" valign="middle" checked="false"><p
align="center"> |;
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|<a href="$long_url"><img src= "$SAVE_DIRECTORY_URL/$rec{$db_key}/$file" width="150" height="150" border="0"></a>|;
}
}


print qq|


</td>
<td align="left" bgcolor="#FFFFFF" width="147" valign="middle" height="20"><small><font
face="Arial"><strong>Stock Number:</strong> <$font>$rec{'StockNumber'}</td>
</tr>
<tr>
<td nowrap align="left" bgcolor="#FFFFFF" width="147" valign="middle" height="20"><small><font
face="Arial"><strong>Year:</strong> <$font>$rec{'Year'}</td>
</tr>
<tr>
<td nowrap align="left" bgcolor="#FFFFFF" width="147" valign="middle" height="20"><small><font
face="Arial"><strong>Make:</strong> <$font>$rec{'Make'}</td>
</tr>
<tr>
<td nowrap align="left" bgcolor="#FFFFFF" width="147" valign="middle" height="20"><small><font
face="Arial"><strong>Model:</strong> <$font>$rec{'Model'}</td>
</tr>
<tr>
<td bgcolor="#FFFFFF" width="147" align="left" valign="middle" height="21"><small><font
face="Arial"><strong>Mileage:</strong> <$font>$rec{'Mileage'}</td>
</tr>
<tr>
<td bgcolor="#FFFFFF" valign="middle" align="left" width="147" height="21"><small><font
face="Arial"><strong>Color:</strong> <$font>$rec{'Ext Color'}</td>
</tr>
<tr>
<td align="center" bgcolor="#CC3333" width="299" colspan="2" height="1"><small><small><font
color="#FFFFFF" face="Arial">Click image to view all details</font></small></small></td>
</tr></table>
</div></td>
</tr></table>
|;

sub html_view_success {
# --------------------------------------------------------
# This page displays the results of a successful search.
# You can use the following variables when displaying your
# results:
#
# $numhits - the number of hits in this batch of results.
# $maxhits - the max number of hits displayed.
# $db_total_hits - the total number of hits.
# $db_next_hits - html for displaying the next set of results.
#

my (@hits) = @_;
my ($numhits) = ($#hits+1) / ($#db_cols+1);
my ($maxhits); $in{'mh'} ? ($maxhits = $in{'mh'}) : ($maxhits = $db_max_hits);
$in{'nh'} ? ($nh = $in{'nh'}) : ($nh = 1);

$page_title = "Search Results";
&html_page_top;

# Go through each hit and convert the array to hash and send to
# html_record for printing.
if ($maxhits == 1) {
&html_record_long(&array_to_hash(0, @hits));
}

else {
print qq|<p><$font>Your search returned <b>$db_total_hits</b> matches.</font>|;
if ($db_next_hits) { print "
<$font>Pages: $db_next_hits</font>"; }
$rec_count = 1;
print "<table>";

print "<table>";
for (0 .. $numhits - 1) {
$i = $_;
unless ($i % 2) {
print "<tr>";
}
print "<td>";
&html_record (&array_to_hash($_, @hits));
print "</td>";
if ($i % 2) {
print "</tr>";
}
}
if ($numhits % 2) {

print "<td> </td></tr>";
}
print "</table>";
print "</tr>";
++$rec_count;
}
print "</table>";
if ($db_next_hits) { print "
<$font>Pages: $db_next_hits</font>";}

&html_footer;

print qq|</td></tr>
</table>
</blockquote>
</body>
</html>
|;

Quote Reply
Re: what am i doing wrong here? In reply to
hmmm ... I guessing here OK? but in my html.pl I use rows vs column but .... I have:

if (($db_total_hits == 1) || ($maxhits == 1)) {

I forgot if the $db_total_hits is part of the mod or not but .... this is the only thing that looks strange to me. I wonder if this would be any help to you? sorry I have no clue, just trying to be helpful.

good luck

**************************************
on the pages in between ...
Quote Reply
Re: what am i doing wrong here? In reply to
That didnt seem to work either but i appreciate your help QooQ.

Quote Reply
Re: what am i doing wrong here? In reply to
$db_next_hits or $db_total_hits shouldn't cause any problems, as they are part of the original setup.
I haven't used any of the mods you are talking about. Logically speaking, if $ENV{'QUERY_STRING'}, which is used as the basis for $long_url, doesn't change for individual records (which I assume is the case), the part responsible for the change would have to be $rec_number. Again, assuming that $nh and $db_max_hits will remain the same (and I suppose they will), the part responsible for any changes must be $rec_count. So the question, I believe, is where $rec_count does get its value from. Is it defined anywhere before html_record or in another subroutine?

kellner
Quote Reply
Re: what am i doing wrong here? In reply to
$rec_count isnt anywhere before the sub html_record. its just in html_record, html_view_success, html_modify form, and html_delete_form.

and in them they either say $rec_count = 1; and/or ++$rec_count;

does this mean anything? i dont really know what to look for

heres my html.pl file
http://members.aol.com/slashd0t/html.pl

thanks for your help

marcus

Quote Reply
Re: what am i doing wrong here? In reply to
I took a look at your html.pl file, but, as I said, I've never used these mods. I find the code quite confusing, but am not sure whether this is due to my own lack of understanding or some real flaws of the code. Probably the former :-)
The general structure is this:
When you have a successful search, the script carries out html_view_success. For each single search result, it then calls html_record to print out the results - in your case, a list of short ones, with links to the long ones.
Now, when you call the long record, you need to pass on some information that tells the script which record to print out code for. In the short/long display I'm using, which is not the same as yours, this information is the record ID.
What really puzzles me is this: in your code, the link to the long record display is done with the variable $long_url. While there is code that changes the next hits number, there is no code that changes that part of $long_url which might contain a record ID. I thought $rec_count was the culprit, but while $rec_count really doesn't change, I don't thing this is relevant for your problem.
I don't understand how $long_url *could* change in the way that it has to for the link to vary for each record - here you probably really need someone who has (successfully) used this mod. Sorry, can't help out on this one.
Lastly, I'm also not quite sure in which way this short/long-mod is supposed to work: Are you supposed to get a list of short records with then ONE link to a list of long records? This is what I initially thought from looking at the mod. Or are you supposed to get a list of short records with a link to a long record display for each of them? This is what some of the code seems to be implying.


kellner
Quote Reply
Re: what am i doing wrong here? In reply to
the short/long mod works like this (well at least for me :-) :

short :

record 1 -- this is a record < link >
record 2 -- blah blah < link >

long:

record 1 -- this is a record. I have lots of information here.

pretty lame explanation but I hope it's understandable.

What I don't understand is why these 2 mods won't work together. errrr this is weird.

OK, time for trouble shooting..

1.) <a href="$long_url"> add another to somewhere outside of the image link area.
2.) add another $rec{$db_key} somewhere else just to see what the number is being sent.

there has to be something screwing up in the image area ... I've gone through the other areas about 4 times now and this is starting to get me. so what I'm recommending is just some value and link tracking to find the culprit.

good luck Crazy

**************************************
on the pages in between ...
Quote Reply
Re: what am i doing wrong here? In reply to
I added a $rec{$db_key} to see what number was coming out like you said and it was different for each listing. so i have no idea why they are going to the same page. ill give whoever gets it to work 20 dollars!!! heheheheh. im lost

thanks for your help guys

marcus

Quote Reply
Re: what am i doing wrong here? In reply to
OK don't want the $20 .... give it LoisC so she could buy some coffee/tea or use it to get rid of some of her banners ;-) I WANT to know why !!! this doesn't work and eventualy your site :-)


I Ok, getting rid of the possible short/long mod possiblities I hope Crazy

question: I see,
$SAVE_DIRECTORY
then ....
$SAVE_DIRECTORY_URL
???? but I don't see how $SAVE_DIRECTORY becomes $SAVE_DIRECTORY_URL (then again I'm perl dumb)

hehe, my helps free but it seems to be taking lots of time. Sorry :-(

good luck, I'll be back in about 7 hours to check up.

**************************************
on the pages in between ...
Quote Reply
Re: what am i doing wrong here? In reply to
I took out the _URL part but i didnt notice any difference.

i was thinking the problem might be something with the &mh or &nh because when i click on any of the short display links it takes me to:
http://localhost/bin/db/db.pl?db=default&uid=admin.99913244257700&view_records=1&StockNumber=*&nh=1&mh=1

at the bottom of the page it has a "Pages: 1 2 3 [>>]" thing
and when i click on page 2 it takes me to:
http://localhost/bin/db/db.pl?db=default&uid=admin.99913244257700&view_records=1&StockNumber=*&mh=1&nh=2

i looked in the html.pl for anything wrong in the &nh and &mh but didnt see anything stand out.

i dont know if this is any help.. hehe

marcus

Quote Reply
Re: what am i doing wrong here? In reply to
OK!!! we're getting somewhere substanstantial finaly ....

notes first (don't quote me on these but Smile)
mh <-- records per page ... I chopped it of mine and still 10 show since I have default.cfg to do that.
nh <-- page number that you're on

I hope that I'm right here ...

here's my jump link to short view ....
http://www.:-P.com/cgi-bin/dbman/db.cgi?db=default&uid=&Maker=IMCRAZY&Model=&Price-gt=---&Price-lt=---&keyword=&mh=10&so=ascend&select=---&view_records=‹L˜^‚𒲂ׂé
... to long view ...
http://www.:-P.com/cgi-bin/dbman/db.cgi?db=default&uid=&Maker=IMCRAZY&Model=&Price-gt=---&Price-lt=---&keyword=&so=ascend&select=---&view_records=‹L˜^‚𒲂ׂé&nh=1&mh=1

now here's one logged in as admin:

http://www.:-P.com/cgi-bin/dbman/db.cgi?db=admin&uid=admin.99915851078263&Maker=IMCRAZY&Model=&Price-gt=---&Price-lt=---&keyword=&mh=10&so=ascend&select=---&view_records=View+Records
... to long view ...
http://www.:-P.com/cgi-bin/dbman/db.cgi?db=admin&uid=admin.99915851078263&Maker=IMCRAZY&Model=&Price-gt=---&Price-lt=---&keyword=&so=ascend&select=---&view_records=View+Records&nh=1&mh=1

hehe maybe we're looking at the wrong areas!!! I have pretty much the same html as you do except for the row and image things....


here's part of my sub html_view_search

print qq|
<form action="$db_script_url" method="GET">
<input type=hidden name="db" value="$db_setup">
<input type=hidden name="uid" value="$db_uid">
|;

&html_search_form();
&html_search_options_price;
&html_search_options;

print qq|


<center>
<INPUT TYPE="SUBMIT" NAME="view_records" VALUE="$submit_button">
<INPUT TYPE="RESET" VALUE="$reset_button">
</center></form>
|;

and part of sub html_search_form

|; print &build_select_field ("Maker", "$rec{'Maker'}"); print qq|

I'm doing a search on Maker .... NOPE not cars that's another project of mine which I start long ago that never got finished cuz I sucked horribly at all of this and JPDeni led me by the hand all the way...


I wonder if any of this will help ??? if you need other areas posted I'll be glad too. Too bad my html.pl is hacked up pretty bad.

good luck


**************************************
on the pages in between ...
Quote Reply
Re: what am i doing wrong here? In reply to
my html_view_search is:
print qq|
<form action="$db_script_url" method="GET" name="form1">
<input type=hidden name="db" value="$db_setup">
<input type=hidden name="uid" value="$db_uid">
|;

&html_record_form();

&html_search_options;

print qq|
<p><center>
<INPUT TYPE="SUBMIT" NAME="view_records" VALUE="$submit_button"> 
<INPUT TYPE="RESET" VALUE="$reset_button">
</center></p></form>
|;

&html_footer;
&html_page_bottom;
}

whats that &html_search_options_price; in yours?

and i dont have a sub html_search_form... hmmmm
is this why it isnt working? lol

by the way, do you see anything wrong with this:
sub html_view_success {
# --------------------------------------------------------
# This page displays the results of a successful search.
# You can use the following variables when displaying your
# results:
#
# $numhits - the number of hits in this batch of results.
# $maxhits - the max number of hits displayed.
# $db_total_hits - the total number of hits.
# $db_next_hits - html for displaying the next set of results.
#

my (@hits) = @_;
my ($numhits) = ($#hits+1) / ($#db_cols+1);
my ($maxhits); $in{'mh'} ? ($maxhits = $in{'mh'}) : ($maxhits = $db_max_hits);
$in{'nh'} ? ($nh = $in{'nh'}) : ($nh = 1);

$page_title = "Search Results";
&html_page_top;

# Go through each hit and convert the array to hash and send to
# html_record for printing.
if ($maxhits == 1) {
&html_record_long(&array_to_hash(0, @hits));
}

else {
print qq|<p><$font>Your search returned <b>$db_total_hits</b> matches.</font>|;
if ($db_next_hits) { print "
<$font>Pages: $db_next_hits</font>"; }
$rec_count = 1;
print "<table>";

print "<table>";
for (0 .. $numhits - 1) {
$i = $_;
unless ($i % 2) {
print "<tr>";
}
print "<td>";
&html_record (&array_to_hash($_, @hits));
print "</td>";
if ($i % 2) {
print "</tr>";
}
}
if ($numhits % 2) {

print "<td> </td></tr>";
}
print "</table>";
print "</tr>";
++$rec_count;
}
print "</table>";
if ($db_next_hits) { print "
<$font>Pages: $db_next_hits</font>";}

&html_footer;

print qq|</td></tr>
</table>
</blockquote>
</body>
</html>

would this be that part that is causing the problem? i dont understand all the codes and stuff. is this what you have?
Quote Reply
Re: what am i doing wrong here? In reply to
sorry for not coming by last night, well for me at least :-) went out for a few drinks ;-)

OOOPS, I use JPDeni's html.pl friendly version (and it's just that friendly) also could be that I added that errr.... forgot. but it sohould be something like html_view_search in the regular html.pl

&html_search_options_price; is just a html sub for making the select price range boxes. SO you shouldn't have that in there ... sorry.

hmmm .... everything looks OK ... if you want send me your html.pl and defualt.cfg (of course, if you want erase the config settings to your server) --- (click my QooQ my email is listed there ... ) gotta go to work but will be back in in about 5 hours and will put it on my dev box. I can then play with it for a while. Hopefully, get something to work.

I'm really sorry that this isn't go as fast as you had hoped!


**************************************
on the pages in between ...
Quote Reply
Re: what am i doing wrong here? In reply to
hey pdressler, QooQ figured it out!!!


in sub html_view_success
add the following line with the >>>>

the rec_count wasn't being added properly

}
>>> add this line >>>> ++$rec_count;
}
if ($numhitscols % 2) {

print "<td> </td></tr>";
}
print "</table>";
print "</tr>";
++$rec_count;
}


thanks QooQ

Quote Reply
Re: what am i doing wrong here? In reply to
Smile

no problem, glad I figured it out. And that it works for you !!!

good luck all

**************************************
on the pages in between ...
Quote Reply
Re: what am i doing wrong here? In reply to
I tried adding the line. It did change the result. Now when I click on the link, I get the record that's before the one I want. Kind of strange. I noticed in your html that you have two ++$rec_count; references. I only had one. So I tried adding another one in different places, but still no luck. Maybe I'm putting them in the wrong position.

Thanks
Paul


> >