Gossamer Forum
Home : Products : Gossamer Links : Discussions :

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

Quote Reply
Re: [Andy] Title & URL for Prev & Next Link (in Detailed.html) In reply to
This edit seems to work perfectly for <%next_url%>, however there is some problem with <%prev_url%> :(, it Shows the title, however without the URL / link :(

Here is the output for <%prev_url%>
<a href="">My Test Listing </a>

--------------------------------------------------------
Global that I am using:
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) {
my $next_link = $CFG->{build_detail_url} . "/" . $DB->table('Links')->detailed_url( $next );
$next_url = qq~<a href="$next_link">$next_title</a>~;
}
if ($prev) {
my $prev_link = $CFG->{build_detail_url} . "/" . $DB->table('Links')->detailed_url( $prev );
$prev_url = qq~<a href="$prev_url">$prev_title</a>~;
}

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

}


I am calling global using (Global name = prev_next1):

Code:
<%prev_next1($ID)%>

1.prev_url : <%if prev_url%> <%prev_url%> <%endif%>
<br><br>
2 next_url: <%if next_url%><%next_url%> <%endif%>

<br><br>

Vishal
-------------------------------------------------------
Subject Author Views Date
Thread Title & URL for Prev & Next Link (in Detailed.html) VishalT 6681 Mar 12, 2020, 5:36 PM
Thread Re: [VishalT] Title & URL for Prev & Next Link (in Detailed.html)
VishalT 6605 Mar 12, 2020, 5:41 PM
Thread Re: [VishalT] Title & URL for Prev & Next Link (in Detailed.html)
Andy 6461 Mar 14, 2020, 2:39 AM
Thread Re: [Andy] Title & URL for Prev & Next Link (in Detailed.html)
VishalT 6450 Mar 14, 2020, 3:59 AM
Post Re: [VishalT] Title & URL for Prev & Next Link (in Detailed.html)
VishalT 6446 Mar 14, 2020, 4:08 AM
Thread Re: [VishalT] Title & URL for Prev & Next Link (in Detailed.html)
Andy 6446 Mar 14, 2020, 4:51 AM
Thread Re: [Andy] Title & URL for Prev & Next Link (in Detailed.html)
VishalT 6434 Mar 14, 2020, 5:02 AM
Thread Re: [VishalT] Title & URL for Prev & Next Link (in Detailed.html)
Andy 6431 Mar 14, 2020, 6:00 AM
Thread Re: [Andy] Title & URL for Prev & Next Link (in Detailed.html)
VishalT 6413 Mar 14, 2020, 11:21 AM
Thread Re: [VishalT] Title & URL for Prev & Next Link (in Detailed.html)
Andy 6286 Mar 16, 2020, 12:12 AM
Post Re: [Andy] Title & URL for Prev & Next Link (in Detailed.html)
VishalT 6274 Mar 16, 2020, 1:04 AM