Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Re: [VishalT] Title & URL for Prev & Next Link (in Detailed.html)

Quote Reply
Re: [VishalT] Title & URL for Prev & Next Link (in Detailed.html) In reply to
This seems to work for me:

Code:
sub {
my $this_link_id = $_[0];

my $db = $DB->table ('Links','CatLinks');
my $cat_id = $db->select ( ['CategoryID'], { LinkID => $this_link_id } )->fetchrow;

# Figure out the next/prev links.
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( ['Links.ID','Links.Title'] => { CategoryID => $cat_id }, VIEWABLE);
my ($next, $prev, $next_title, $prev_title);
while (my ($id,$title) = $sth->fetchrow) {
if ($id == $this_link_id) {
($next,$next_title) = $sth->fetchrow_array;
last;
}
else {
$prev = $id;
$prev_title = $title;

}
}

my ($next_url, $prev_url);
if ($next) {
$next_url = qq~<a href="$CFG->{db_cgi_url}/page.cgi?g=Detailed/$next.html&d=1">$next_title</a>~;
}
if ($prev) {
$prev_url = qq~<a href="$CFG->{db_cgi_url}/page.cgi?g=Detailed/$prev.html&d=1">$prev_title</a>~;
}

return { next_url => $next_url, prev_url => $prev_url };

}

You have to call it a little differently:

Code:
<%global_name($ID)%>

Then it will give you <%next_url%> and <%prev_url%>

I've tested it on my test install and it works perfectly:

Code:
NEXT: <a href="http://gossamer.ultranerds.co.uk/cgi-bin/page.cgi?g=Detailed/266.html&d=1">SimpleDesign</a>
PREV: <a href="http://gossamer.ultranerds.co.uk/cgi-bin/page.cgi?g=Detailed/268.html&d=1">NaturalDesign</a>

Cheers

Andy

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Subject Author Views Date
Thread Title & URL for Prev & Next Link (in Detailed.html) VishalT 6645 Mar 12, 2020, 5:36 PM
Thread Re: [VishalT] Title & URL for Prev & Next Link (in Detailed.html)
VishalT 6569 Mar 12, 2020, 5:41 PM
Thread Re: [VishalT] Title & URL for Prev & Next Link (in Detailed.html)
Andy 6425 Mar 14, 2020, 2:39 AM
Thread Re: [Andy] Title & URL for Prev & Next Link (in Detailed.html)
VishalT 6414 Mar 14, 2020, 3:59 AM
Post Re: [VishalT] Title & URL for Prev & Next Link (in Detailed.html)
VishalT 6410 Mar 14, 2020, 4:08 AM
Thread Re: [VishalT] Title & URL for Prev & Next Link (in Detailed.html)
Andy 6410 Mar 14, 2020, 4:51 AM
Thread Re: [Andy] Title & URL for Prev & Next Link (in Detailed.html)
VishalT 6398 Mar 14, 2020, 5:02 AM
Thread Re: [VishalT] Title & URL for Prev & Next Link (in Detailed.html)
Andy 6394 Mar 14, 2020, 6:00 AM
Thread Re: [Andy] Title & URL for Prev & Next Link (in Detailed.html)
VishalT 6376 Mar 14, 2020, 11:21 AM
Thread Re: [VishalT] Title & URL for Prev & Next Link (in Detailed.html)
Andy 6250 Mar 16, 2020, 12:12 AM
Post Re: [Andy] Title & URL for Prev & Next Link (in Detailed.html)
VishalT 6238 Mar 16, 2020, 1:04 AM