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';