Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Random Jump To Detail

Quote Reply
Random Jump To Detail
Hi All

I'm trying to get jump.cgi to do a Random Jump to the Detailed pages (instead of the URL).

What I've found so far is the code in jump.pm:
Code:
# If we are chosing a random link, then get the total and go to one at random.
if (lc $id eq "random") {
my $total = $db->total() - $db->count({ isValidated => 'No' });
my $offset = int rand $total;
$db->select_options ("LIMIT $offset, 1");
my $sth = $db->select ( { isValidated => 'Yes' }, ['URL'] );
($goto) = $sth->fetchrow_array;
}

What I need to figure out is how to adjust this so that it picks up the detail page, not the url.

I see the URL field mentioned, but I haven't found where any URL index is built (like in flatfile Links). What I did in the flatfile version is copy the build_url_index routine and make some changes, rename it build_detail_index, and then create a detail.db in /data/

I'm trying to customize SQL as a storefront or catalog system. So, having random jumps to the detail pages would be neat.

Thanks for any suggestions. Smile

DT
Quote Reply
Re: [DogTags] Random Jump To Detail In reply to
Hi,

Use:

Code:
my $sth = $db->select ( { isValidated => 'Yes' }, ['ID'] );
my ($link_id) = $sth->fetchrow_array;
$goto = $CFG->{build_detail_url} . '/' . $link_id . '.html';
Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Random Jump To Detail In reply to
Thanks, Alex Smile

This works great for static detail pages.

What if you wanted to have a random jump to a dynamic detail page?

This is a concern because of space considerations.

Many thanks for your help Smile

DT

Last edited by:

DogTags: Sep 16, 2001, 10:40 PM
Quote Reply
Re: [DogTags] Random Jump To Detail In reply to
DogTags,

I believe all you need to do is edit the following line of codes:

Code:

$goto = $CFG->{build_detail_url} . '/' . $link_id . '.html';


to something like:

Code:

$goto = $CFG->{build_detail_cgi_url} . '?ID=' . $link_id;


Now, that is if you have defined the "detailed" cgi script as
a global variable...
========================================
Buh Bye!

Cheers,
Me

Last edited by:

AnthroRules: Sep 17, 2001, 7:02 AM
Quote Reply
Re: [AnthroRules] Random Jump To Detail In reply to
Close, it should be:

$goto = $CFG->{db_cgi_url} . "/page.cgi?g=Detailed/$link_id.html";

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Random Jump To Detail In reply to
Thank you very kindly, AnthroRules and Alex

I plugged in what you suggested, Alex, and it's a bulls-eye - Yeah! Cool

Now, I have just a few more things to work on, and I'll have this thing rolling...

Thanks Tons Smile

DT
Quote Reply
Re: [Alex] Random Jump To Detail In reply to
Okay, here's an interesting problem.

Alex's code works super to build and jump to the random detail page dynamically.

However, I use the title_linked tag on the detail pages, and, when the page is dynamically generated by a random jump, the title_linked is to static pages, but should be to page.cgi

If I build my site dynamically, the progression from home to category to link maintains the title_linked to page.cgi

Only when I use the random jump to dynamic detail does the title_linked on those detail pages point to static pages (which do not exist).

What might be happening? Is there a way to get the random jump to a dynamically generated detail page to keep title_linked pointing to page.cgi ?

Thanks very much.Smile

DT

Last edited by:

DogTags: Sep 17, 2001, 8:40 AM
Quote Reply
Re: [DogTags] Random Jump To Detail In reply to
Hi

Just bringing this one to the top...

ThanksSmile

DT
Quote Reply
Re: [DogTags] Random Jump To Detail In reply to
Hi,

You need to pass in d=1 to the script to make it generate dynamic links. So change:

$goto = $CFG->{db_cgi_url} . "/page.cgi?g=Detailed/$link_id.html";

to:

$goto = $CFG->{db_cgi_url} . "/page.cgi?g=Detailed/$link_id.html&d=1";

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Random Jump To Detail In reply to
Bee-U-Tee-Ful !!

Thanks, Alex Cool

DT