Gossamer Forum
Home : Products : Gossamer Links : Discussions :

<%next%> <%prev%> - detailed page

Quote Reply
<%next%> <%prev%> - detailed page
Hi,

I just discovered these tags in the default detailed.html.

<%if prev_url%>&nbsp;<A href="<%prev_url%>">Previous</a><%endif%><%if next_url%>&nbsp;<a href="<%next_url%>">Next</a><%endif%>

I'm just wondering if these only work with static pages?

If it works with dynamic pages, I'm guessing I have to pass the category ID or name but I've tried everything I can think of and still get errors.

Thanks,


Richard White
http://www.AffiliateFirst.com
Quote Reply
Re: [RWhite] <%next%> <%prev%> - detailed page In reply to
If I am not mistaken, you are not required to write <a href="<%prev_url%>">, just write <%prev_url%> and it should work.

Hope this helps :)

Vishal
-------------------------------------------------------
Quote Reply
Re: [RWhite] <%next%> <%prev%> - detailed page In reply to
The sample code you provided works great for both static and dynamic builds. I use the tags in a simlar way and haven't had any problems. Unless I've misunderstood there should be no reason to pass the ID. The tags will take care of all of that for you :)

Good luck
Quote Reply
Re: [RWhite] <%next%> <%prev%> - detailed page In reply to
I don't think it works with Pugdogs detail page plugin if that's what you mean by dynamic detail pages. I think it just needs some extra code in the plugin to define the <%prev_url%> and <%next_url%> tags. Shouldn't be too difficult. (Don't have time to look into this just at the moment).

Laura.
The UK High Street
Post deleted by RWhite In reply to
Quote Reply
Re: [RWhite] <%next%> <%prev%> - detailed page In reply to
OK, take a look at;

http://www.affiliatefirst.com/...uicklook&ID=4442

I was thinking I needed to pass the category somehow so it knows what to look for as next and previous.

The code is on the page above the banner as

<%if prev_url%>&nbsp;<A href="<%prev_url%>">Previous</a><%endif%><%if next_url%>&nbsp;<a href="<%next_url%>">Next</a><%endif%>


I'm not using the detailed plug-in and I tried dropping the <a href that didn't work



Thanks, the reponses are appreciated.
Richard White
http://www.AffiliateFirst.com

Last edited by:

RWhite: Oct 25, 2002, 5:49 PM
Quote Reply
Re: [RWhite] <%next%> <%prev%> - detailed page In reply to
These tags are specially created for the detail pages. You'll need to create a global to calculate them if you want to use them on other pages. I haven't tested this so its unlikely to work straight off Wink. Call this global something like nextprev and add a tag at the top of your template <%nextprev%>. Then once it's working you should be able to use the <%next_url%> and <%prev_url%> tags. You'll need to add the catID to the url unless you already have it as an available tag in the template.



sub {

my $args=shift;

my $cat_id = $IN->param('catID');

my $catlnk_db = $DB->table ('Links', 'CatLinks');
$catlnk_db->select_options ("ORDER BY $CFG->{build_sort_order_category}") if ($CFG->{build_sort_order_category});
my $sth = $catlnk_db->select ( { CategoryID => $cat_id, isValidated => 'Yes' }, [ 'Links.ID' ] );
my ($next, $prev);
while (my ($id) = $sth->fetchrow_array) {
if ($id == $args->{ID}) {
($next) = $sth->fetchrow_array;
last;
}
else {
$prev = $id;
}
}
my ($next_url, $prev_url);
if ($next) {
$next_url = "$CFG->{build_detail_url}/$next$CFG->{build_extension}";;
}
if ($prev) {
$prev_url = "$CFG->{build_detail_url}/$prev$CFG->{build_extension}";;
}
return {next_url => $next_url, prev_url => $prev_url};

}
The UK High Street
Quote Reply
Re: [afinlr] <%next%> <%prev%> - detailed page In reply to
I tried it and doesn't work on the detailed either.

I really don't care what the page is named so if that's all it takes I'd do it.

I've tried the default detailed page and it doesn't work..

Thanks,
Richard White
http://www.AffiliateFirst.com
Quote Reply
Re: [RWhite] <%next%> <%prev%> - detailed page In reply to
Just a quick check - do you have detailed pages turned on in your admin? (Admin>Setup>Build Options>build_detailed - yes or no).
The UK High Street
Quote Reply
Re: [RWhite] <%next%> <%prev%> - detailed page In reply to
Just to let you know, I've just tested the global above and it does work as written on my site on my dynamic detail pages. However, you do need to pass in the category id. This one should work out a category id for you. Also, i've rewritten the urls so they should work on your site. You need to put the tag <%nextprev%> at the top of the page - above any tags for next_url etc.

sub {
my $args=shift;
#my $cat_id = $IN->param('catID');
my $db = $DB->table ('Category','CatLinks');
my ($cat_id,$full_name) = $db->select ( { 'CatLinks.LinkID' => $args->{ID} }, ['Category.ID', 'Category.Heading1'] )->fetchrow_array;

my $catlnk_db = $DB->table ('Links', 'CatLinks');
$catlnk_db->select_options ("ORDER BY $CFG->{build_sort_order_category}") if ($CFG->{build_sort_order_category});
my $sth = $catlnk_db->select ( { CategoryID => $cat_id, isValidated => 'Yes' }, [ 'Links.ID' ] );
my ($next, $prev);
while (my ($id) = $sth->fetchrow_array) {
if ($id == $args->{ID}) {
($next) = $sth->fetchrow_array;
last;
}
else {
$prev = $id;
}
}
my ($next_url, $prev_url);
if ($next) {
$next_url = "$CFG->{db_cgi_url}/page.cgi?p=quicklook&ID=$next";;
}
if ($prev) {
$prev_url = "$CFG->{db_cgi_url}/page.cgi?p=quicklook&ID=$prev";;
}
return {next_url => $next_url, prev_url => $prev_url};

}


Let me know how you get on.

Laura.
The UK High Street
Quote Reply
Re: [afinlr] <%next%> <%prev%> - detailed page In reply to
Laura,

Thank you.

I do have the dynamic pages set to yes.

I tried the code and got an error. I'm beginning to think it may be my Links.

I thought I had 2.11 running but I noticed my admin says 2.05. (not sure when the <%next%... <%prev%> was added) I'm going to do an update today and test it again.

Thanks again,

Richard
Richard White
http://www.AffiliateFirst.com
Quote Reply
Re: [RWhite] <%next%> <%prev%> - detailed page In reply to
Oops, I've just spotted a mistake Blush - Heading1 is a column in my Links table which you don't need in the code. (This is the problem with testing things on your own site which is not standard). Try changing it to this:

sub {
my $args=shift;
#my $cat_id = $IN->param('catID');
my $db = $DB->table ('Category','CatLinks');
my $cat_id = $db->select ( { 'CatLinks.LinkID' => $args->{ID} }, ['Category.ID'] )->fetchrow_array;

my $catlnk_db = $DB->table ('Links', 'CatLinks');
$catlnk_db->select_options ("ORDER BY $CFG->{build_sort_order_category}") if ($CFG->{build_sort_order_category});
my $sth = $catlnk_db->select ( { CategoryID => $cat_id, isValidated => 'Yes' }, [ 'Links.ID' ] );
my ($next, $prev);
while (my ($id) = $sth->fetchrow_array) {
if ($id == $args->{ID}) {
($next) = $sth->fetchrow_array;
last;
}
else {
$prev = $id;
}
}
my ($next_url, $prev_url);
if ($next) {
$next_url = "$CFG->{db_cgi_url}/page.cgi?p=quicklook&ID=$next";;
}
if ($prev) {
$prev_url = "$CFG->{db_cgi_url}/page.cgi?p=quicklook&ID=$prev";;
}
return {next_url => $next_url, prev_url => $prev_url};

}


Sorry about that. Hope it works this time.

By the way, you don't need detailed pages turned on if you're not using the static detailed pages - I just thought that might be an easy fix to get this working. If you're going to keep using your dynamic pages you should just be able to use this global. I'm not sure what the difference is between 2.05 and the current version of links but I would be surprised if that's the problem - hopefully it should work now?

Laura.
The UK High Street
Quote Reply
Re: [afinlr] <%next%> <%prev%> - detailed page In reply to
Laura,

Your awesome! Thank you, I didn't have to update to 2.11, it worked like a charm.

If I can return your favor and help you in anyway please let me know.

Happy Halloween,

Richard
Richard White
http://www.AffiliateFirst.com