NikonErik wrote on Sep 8
th, 2009 at 11:48pm:
How can I have this Mod at the bottom of each thread-page above the footer so the viewer can easily jump to another topic if they want?
Quick Solution:In MessageIndex.pl
search for:
$messageindex_template =~ s/({|<)yabb pageindex bottom(}|>)/$pageindex2/g;
and
add after:
# Start part from the newest topic mod in this file:
{
# Can pass items to this sub, to decide what to show:
my ($show_count, $show_board, $show_poster, $show_views, $show_replies, $show_date) = @_;
my $display = $INFO{'display'} || $numnewesttopics;
if ($display < 0) { $display = 5; }
# display newest_topics
if ($display)
{
$show_count = 1;
$show_board = 1;
$show_poster = 1;
$show_views = 1;
$show_replies = 1;
$show_date = 1;
}
my (@memset, @categories, %data, $numfound, $curcat, %catname, %cataccess, %catboards, $openmemgr, @membergroups, %openmemgr, $curboard, @threads, @boardinfo, $i, $c, @messages, $tnum, $tsub, $tname, $temail, $tdate, $treplies, $tusername, $ticon, $tstate, $mname, $memail, $mdate, $musername, $micon, $mattach, $mip, $mns, $mtime, $counter, $board, $notify);
foreach $catid (@categoryorder) {
$boardlist = $cat{$catid};
(@bdlist) = split(/\,/, $boardlist);
($catname, $catperms) = split(/\|/, $catinfo{$catid});
$cataccess = &CatAccess($catperms);
if (!$cataccess) { next; }
foreach $curboard (@bdlist) {
($boardname{$curboard}, $boardperms, $boardview) = split(/\|/, $board{$curboard});
my $access = &AccessCheck($curboard, '', $boardperms);
if (!$iamadmin && $access ne "granted") { next; }
$catid{$curboard} = $catid;
$catname{$curboard} = $catname;
fopen(REC_BDTXT, "$boardsdir/$curboard.txt");
for ($i = 0; $i < $display && ($buffer = <REC_BDTXT>); $i++) {
($tnum, $tsub, $tname, $temail, $tdate, $treplies, $tusername, $ticon, $tstate) = split(/\|/, $buffer);
chomp $tstate;
if ($tstate !~ /h/ || $iamadmin || $iamgmod) {
$mtime = $tdate;
$data[$numfound] = "$mtime|$curboard|$tnum|$tusername|$tname|$treplies";
$numfound++;
}
}
fclose(REC_BDTXT);
}
}
@data = sort {$b <=> $a} @data;
$numfound = 0;
for ($i = 0; $i < @data; $i++) {
($mtime, $curboard, $tnum, $tusername, $tname, $treplies) = split(/\|/, $data[$i]);
fopen(REC_THRETXT, "$datadir/$tnum.txt") || next;
while (<REC_THRETXT>) { $message = $_; }
# get only the last post for this thread.
fclose(REC_THRETXT);
chomp $message;
if ($message) {
($msub, $mname, $memail, $mdate, $musername, $mreplies, $micon, $mattach, $mip, $message, $mns) = split(/\|/, $message);
$messages[$numfound] = "$curboard|$tnum|$treplies|$tname|$tusername|$msub|$mname|$mdate|$musername";
$numfound++;
}
if ($numfound == $display) { last; }
}
&LoadCensorList;
$counter = 1;
$nt .= qq~
<table class="windowbg2" cellpadding="4" cellspacing="1" border="0"width="100%">
<tr>
<div style="float: left; text-align: left;">
<span class="small">
<td class="windowbg2" align="left"><span class="small">
<b>$newest_topics{'01'}</b></span>
</td>
<td class="windowbg2" align="left"><span class="small">
<b>$newest_topics{'02'}</b></span>
</td>
<td class="windowbg2" align="left"><span class="small">
<b>$newest_topics{'03'}</b></span>
</td>
<td class="windowbg2" align="left"><span class="small">
<b>$newest_topics{'04'}</b></span>
</td>
<td class="windowbg2" align="center"><span class="small">
<b>$newest_topics{'05'}</b></span>
</td>
<td class="windowbg2" align="center"><span class="small">
<b>$newest_topics{'06'}</b></span>
</td>
<td class="windowbg2" align="left"><span class="small">
<b>$newest_topics{'07'}</b></span>
</td>
</span>
</div>
</tr>
~;
for ($i = 0; $i < $numfound; $i++) {
chomp $messages[$i];
($board, $tnum, $c, $tusername, $tname, $msub, $mname, $mdate, $musername, $mreplies, undef) = split(/\|/, $messages[$i]);
chomp $musername;
$msub = &Censor($msub);
&ToChars($msub);
if ($musername ne 'Guest' && -e "$memberdir/$musername.vars") {
&LoadUser($musername);
&MessageTotals("load",$tnum);
$mname = exists ${$uid.$musername}{'realname'} ? ${$uid.$musername}{'realname'} : $mname;
$mname ||= $maintxt{'470'};
$mname = qq~<a href="$scripturl?action=viewprofile;username=$useraccount{$musername}" title="$maintxt{'27'}: $mname">${$uid.musername}{'realname'}$format{$musername}</a>~;
}
elsif($musername ne 'Guest') {
$mname ||= $maintxt{'470'};
}
$mname ||= $maintxt{'28'};
$mdate = &timeformat($mdate);
# Strip all Re: from subject lines
# only if it occurs at the start.
$msub =~ s/\ARe: //ig;
# Change [m] to Moved:
$msub =~ s/\[m.*?\]/$maintxt{'758'}/;
$nt .= qq~ <tr class="windowbg">~;
if ($show_count) {
$nt .= qq~
<td valign="middle" align="left"><span class="small">$counter.</span></td>
~;
}
if ($show_board) {
$nt .= qq~
<td valign="middle" align="left"><span class="small"><a href="$scripturl?board=$board">$boardname{$board}</a></span></td>
~;
}
$nt .= qq~
<td valign="middle" align="left"><span class="small"><a href="$scripturl?num=$tnum">$msub</a></span></td>
~;
if ($show_poster) {
$nt .= qq~
<td valign="middle" align="left"><span class="small">$tusername</span></td>
~;
}
if ($show_views) {
$nt .= qq~
<td valign="middle" align="center"><span class="small">${$tnum}{'views'}</span></td>
~;
}
if ($show_replies) {
$nt .= qq~
<td valign="middle" align="center"><span class="small">${$tnum}{'replies'}</span></td>
~;
}
if ($show_date) {
$nt .= qq~
<td valign="top" align="left"><font size="1"><a href="$scripturl?num=$tnum/$c#$c">$img{'lastpost'}</a> $mdate<br />$newest_topics{'07a'} $mname</td>
</tr>
~;
}
++$counter;
}
$nt .= qq~
</div>
</table>
~;
}
$messageindex_template =~ s/({|<)yabb nt(}|>)/$nt/g;
# End part from the newest topic mod in this file:
In MessageIndex.template (default template)
search for:
<!-- Icon and access info start -->
and
add before:
<!-- Newest board topics block start -->
~;
if($lastnewesttopics == 1) {
$messageindex_template .= qq~
<br />
<table class="bordercolor" cellpadding="0" cellspacing="0" border="0" width="100%">
<tr>
<td class="titlebg" width="1%" height="25" valign="middle">
</td>
<td class="titlebg" width="99%" height="25" valign="middle">
<span class="ie6alpha">$newest_topics{'08'} $numnewesttopics $newest_topics{'09'}</span>
</td>
</tr>
</table>
<table class="bordercolor" cellpadding="4" cellspacing="1" border="0" width="100%">
<tr>
<td class="windowbg" width="5%" valign="middle" align="center">
<img src="$imagesdir/info.gif" border="0" alt="" />
</td>
<td class="windowbg2" valign="top" align="center">
<div class="small" style="float: left; width: 100%; text-align: left;">{yabb nt}</div>
</td>
</tr>
</table><br />
~;
}
$messageindex_template .= qq~
<!-- newest board topics block end -->
Hope it runs. If I have more time, I will update the mod and add new settings.