Gossamer Forum
Home : Products : DBMan : Customization :

I'm back - Help with Short & Long Display (esp. Short)

Quote Reply
I'm back - Help with Short & Long Display (esp. Short)
At the following URL:
www.outermost.net/cgi-bin/db/db.cgi?db=mra&mh=2&uid=default&so=ascend&sb=2&view_records=1&ID=*
You can see that I want to be able to list the reviews that are in my database. I want them to appear in the white space, but only one appears and then the whole table is created again for the next one. I set the maxhits to 2, but it will do this regardless. How do I get it to creat a list of reviews (e.g. search results) in this table? Is this possible?

If you have any questions regarding the quasi-cryptic post, please feel free to contact me using any of the ways below - I'll get back to you A.S.A.P.

Thanks in advance,
Blake Kunisch
blake@outermost.net
ICQ UIN: 7703534

Here's my mra.pl (formerly html.pl)
http://www.outermost.net/mra_pl.txt
Some unnecessary subroutines are cut out to make it smaller (I use html.pl to modify and such).

[This message has been edited by blakex (edited August 08, 1999).]
Quote Reply
Re: I'm back - Help with Short & Long Display (esp. Short) In reply to
I don't think I can explain what to do until I see your html.pl file. I think you'll remember how to make it available to me. Smile


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





Quote Reply
Re: I'm back - Help with Short & Long Display (esp. Short) In reply to
You must of posted right after I edited or at the same time almost...

Just moving it back up so that you take another look at it JPDeni. Thanks again!

-Blake
Quote Reply
Re: I'm back - Help with Short & Long Display (esp. Short) In reply to
In html_record, find the line

Code:
<td width="100%" bgcolor="#FFFFFF"><a href="$long_url">$rec{'Title'} ($rec{'Year'} -
Rating: $rec{'Rating'} / 10 - Posted: $rec{'PostDate'}</td>

(I broke it up into two so it wouldn't scroll too far to the right.)

Put everything before that in sub html_view_success, before

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

Put everything after that line above (the one where you print out the title, ect.) after the code just above. You'll probably have to play around a bit with your tables to get them how you want them.


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





Quote Reply
Re: I'm back - Help with Short & Long Display (esp. Short) In reply to
I knew you'd have to play around with your tables some. It's hard to know what to do until you actually work with it.

I'm not sure what you mean by
Quote:
Is it possible to have the links point to my default.cfg rather than mra.cfg (db=default)?

If you mean the links to the "long" record, yes, it's possible, but it would mean doing some more coding. Maybe tomorrow. Smile



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





Quote Reply
Re: I'm back - Help with Short & Long Display (esp. Short) In reply to
Works perfectly. Now customizing it Smile...

Is it possible to have the links point to my default.cfg rather than mra.cfg (db=default)? This would make my editing job much easier.

Here's the URL of the cool search results:
http://www.outermost.net/...w_records=1&ID=*

Also, I have updated the mra_pl.txt at my site.

Thanks,
Blake
Quote Reply
Re: I'm back - Help with Short & Long Display (esp. Short) In reply to
Also I found that rather than putting the code after:
Code:
$i = 1;
print "<table>";
for (0 .. $numhits - 1) {
print "<tr>";
&html_record (&array_to_hash($_, @hits));
print "</tr>";
++$i;
}

<PUT YOUR CODE HERE>

print "</table>";
You want to put the code after the } and not after the print "</table>" because the </table> throws everything out of wack.

-Blake

[This message has been edited by blakex (edited August 09, 1999).]
Quote Reply
Re: I'm back - Help with Short & Long Display (esp. Short) In reply to
 
Quote:
If you mean the links to the "long" record, yes, it's possible, but it would mean doing some more coding. Maybe tomorrow.

Yes, this is exactly what I mean, when the user clicks to retrieve the long record, they get db=default. There's absolutely no rush on this because the new database won't be going into place for a while, but it would be nice to get everything tweaked as soon as possible. Just whenever you have time, you've been such a great help.

-Blake
Quote Reply
Re: I'm back - Help with Short & Long Display (esp. Short) In reply to
Well, this isn't as hard as I first thought it might be. (Besides, if I wait, I'll forget. Smile )

In sub html_record, look for the lines:

Code:
$long_url =~ s/\&mh=\d+//;

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

make the changes in bold below

Code:
$long_url =~ s/\&mh=\d+//;
$long_url =~ s/\&db=mra//;

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

I think that should work.


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





Quote Reply
Re: I'm back - Help with Short & Long Display (esp. Short) In reply to
I tried that (I think) - it's hard to tell bold within <CODE> tags. Here's the edited code:
Code:
$record_number = ((($nh - 1) * $db_max_hits) + $i);

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

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

If you go to the site, you'll notice instead of db=mra, it has db=default&db=mra which confuses the script.

Thanks for the tips.
-Blake
Quote Reply
Re: I'm back - Help with Short & Long Display (esp. Short) In reply to
I'm new at working with the query string. Instead of

$long_url =~ s/\&db=mra//;

try

$long_url =~ s/db=mra//;

That might do it.


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





Quote Reply
Re: I'm back - Help with Short & Long Display (esp. Short) In reply to
Thank You, Thank You, Thank You!!

That worked, except for one minor bug which was easily fixed. In this line:

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

Take out the & after default otherwise your URL will have && in it after db=default.

Another quick question though, I noticed the default Sort Order is by ID - how can I change the default Sort Order to Title or entry 2 (sb=2 by default). This would then make it so I can sort them by Rating (sb=3) and then by default, it will sort all the ratings that are the same by Title (sb=2).

Is this possible, if not, no problem, I'll just let it be.

Thanks soooo much JPDeni,
Blake Kunisch
Quote Reply
Re: I'm back - Help with Short & Long Display (esp. Short) In reply to
You can make the default sort order to be any field you want by setting it in the search options part of the search form. But even if you somehow made the default order to search by Title within the script, it still wouldn't do what you want to do when it searches by Ratings.

The default search order isn't really by ID. It's by the order the records were added to the file, which happens to correspond (usually) to the ID field if you're using a counter.

You're very welcome! Smile
------------------
JPD







[This message has been edited by JPDeni (edited August 09, 1999).]
Quote Reply
Re: I'm back - Help with Short & Long Display (esp. Short) In reply to
Now that I know how they are sorted by default (order added to database) it will help me a lot. I read in another post that the next version of dbman might support sorting by multiple records (Rating then Title) which would be a great feature. Any idea when that might be coming out??

-Blake
Quote Reply
Re: I'm back - Help with Short & Long Display (esp. Short) In reply to
Nope. No idea at all. I'm not really affiliated with Gossamer Threads. I just hang around here because I don't have anything better to do. Smile



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