Previous/Next topics mod
1.5
This mod adds 'Previous topic' and 'Next topic' links to the top of each thread page, so you can quickly jump from thread to thread without having to go back to the message index page every time.
Simply install the mod and upload! Only edits one file! ;)
Update v1.5: Changed the code so that if there is no previous topic, it doesn't display the previous topic link and go to the last topic on the board as it did before.
Also, changed the wording a bit, cos people were getting confused about the 'active' topic bit!
Sam Holman (Samm)
http://www.shlmn.com
Sources/Display.pl
foreach (@censored) {
($tmpa,$tmpb) = @{$_};
$msubthread =~ s~\Q$tmpa\E~$tmpb~gi;
}
$curthreadurl = $curposlinks ? qq~$msubthread~ : $msubthread;
fopen(FILE, "$boardsdir/$INFO{'board'}.txt");
@boardtopics = ;
fclose (FILE);
$CurrentPosition = -1;
my $found;
my $name = $INFO{'num'};
fopen(LIST, "$boardsdir/$INFO{'board'}.txt");
while( $ThreadNum = ) {
++$CurrentPosition;
if ( $ThreadNum =~ m/\A$name/o ) { $found = 1; last; }
}
fclose(LIST);
$previous = $boardtopics[$CurrentPosition-1];
$next = $boardtopics[$CurrentPosition+1];
@prevthread = split(/\|/, $previous);
$goprevious = $prevthread[0];
@nextthread = split(/\|/, $next);
$gonext = $nextthread[0];
@getlastthread = @boardtopics;
$lastthread = pop(@getlastthread);
@lasttopic = split(/\|/, $lastthread);
$endthread2 = $lasttopic[0];
if($found) {
$prevtopic = "$cgi&action=display&num=$goprevious";
$nexttopic = "$cgi&action=display&num=$gonext";
$endthread = "$cgi&action=display&num=$endthread2";
}
$boardname

$curthreadurl
$showmods
EOT
if( $endthread eq $prevtopic && $gonext eq "") {
print <<"EOT";
< No topic | No topic > |
EOT
}
if($endthread eq $prevtopic && $gonext ne "") {
print <<"EOT";
|
EOT
}
if ( $endthread ne $prevtopic && $gonext eq "") {
print <<"EOT";
|
EOT
}
if ($endthread ne $prevtopic && $gonext ne "") {
print <<"EOT";
|
EOT
}
print <<"EOT";