From cb16ad0bd4f8866aaa9c249fb75db32b52f6c187 Mon Sep 17 00:00:00 2001 From: Trevor Slocum Date: Wed, 16 Jan 2013 17:39:45 -0800 Subject: [PATCH] Fix reply order on index pages --- inc/html.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/inc/html.php b/inc/html.php index 569960c..3c5c659 100644 --- a/inc/html.php +++ b/inc/html.php @@ -280,14 +280,14 @@ function rebuildIndexes() { foreach ($threads as $thread) { $replies = postsInThreadByID($thread['id']); $thread['omitted'] = max(0, count($replies) - TINYIB_PREVIEWREPLIES - 1); - - $htmlposts .= buildPost($thread, TINYIB_INDEXPAGE); - + + // Build replies for preview + $htmlreplies = array(); for ($j = count($replies) - 1; $j > $thread['omitted']; $j--) { - $htmlposts .= buildPost($replies[$j], TINYIB_INDEXPAGE); + $htmlreplies[] = buildPost($replies[$j], TINYIB_INDEXPAGE); } - - $htmlposts .= "
\n
"; + + $htmlposts .= buildPost($thread, TINYIB_INDEXPAGE) . implode('', array_reverse($htmlreplies)) . "
\n
"; if (++$i >= TINYIB_THREADSPERPAGE) { $file = ($page == 0) ? 'index.html' : $page . '.html';