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
Hi,

Yup - <%next%> , <%next_url%> etc are available as standard. You could try:

Code:
sub {
my $args=shift;
my $db = $DB->table ('Links','CatLinks');
my $cat_id = $db->select ( ['CategoryID'], { LinkID => $args->{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' => { CategoryID => $cat_id }, VIEWABLE);
my ($next, $prev, $next_title, $prev_title);
while (my ($id,$title) = $sth->fetchrow) {
if ($id == $link->{ID}) {
($next,$next_title) = $sth->fetchrow;
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};

}

Personally, though, I would just hard-code the tweaks into /admin/Links/Build.pm, finding sub build_detailed , and change:

Code:
# 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' => { CategoryID => $cat_id }, VIEWABLE);
my ($next, $prev);
while (my $id = $sth->fetchrow) {
if ($id == $link->{ID}) {
$next = $sth->fetchrow;
last;
}
else {
$prev = $id;
}
}

to:

Code:
# 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' => { CategoryID => $cat_id }, VIEWABLE);
my ($next, $prev, $next_title, $prev_title);
while (my ($id,$title) = $sth->fetchrow) {
if ($id == $link->{ID}) {
($next,$next_title) = $sth->fetchrow;
last;
}
else {
$prev = $id;
$prev_title = $title;

}
}


Untested, but should work

Cheers

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 6644 Mar 12, 2020, 5:36 PM
Thread Re: [VishalT] Title & URL for Prev & Next Link (in Detailed.html)
VishalT 6568 Mar 12, 2020, 5:41 PM
Thread Re: [VishalT] Title & URL for Prev & Next Link (in Detailed.html)
Andy 6424 Mar 14, 2020, 2:39 AM
Thread Re: [Andy] Title & URL for Prev & Next Link (in Detailed.html)
VishalT 6413 Mar 14, 2020, 3:59 AM
Post Re: [VishalT] Title & URL for Prev & Next Link (in Detailed.html)
VishalT 6408 Mar 14, 2020, 4:08 AM
Thread Re: [VishalT] Title & URL for Prev & Next Link (in Detailed.html)
Andy 6408 Mar 14, 2020, 4:51 AM
Thread Re: [Andy] Title & URL for Prev & Next Link (in Detailed.html)
VishalT 6397 Mar 14, 2020, 5:02 AM
Thread Re: [VishalT] Title & URL for Prev & Next Link (in Detailed.html)
Andy 6393 Mar 14, 2020, 6:00 AM
Thread Re: [Andy] Title & URL for Prev & Next Link (in Detailed.html)
VishalT 6375 Mar 14, 2020, 11:21 AM
Thread Re: [VishalT] Title & URL for Prev & Next Link (in Detailed.html)
Andy 6248 Mar 16, 2020, 12:12 AM
Post Re: [Andy] Title & URL for Prev & Next Link (in Detailed.html)
VishalT 6237 Mar 16, 2020, 1:04 AM