The comments link is just a link back to the thread itself, with the "replies". It's actually a little messy because Pun only keeps a link to the last post in the thread table, not a link to the first post:
require_once(PUN_ROOT . 'include/parser.php');
$large = 3; // full posts
$small = 10; // parting shot links
$query = 'SELECT id, poster, subject, posted, num_replies FROM `topics` WHERE forum_id=1003 ORDER BY posted DESC LIMIT ' . ($large + $small);
$result = $db->query($query);
while($large-- > 0)
{
$one = $db->fetch_assoc($result);
$query_post = 'SELECT message, poster_id FROM posts WHERE topic_id='.$one['id'].' ORDER BY posted ASC LIMIT 1';
$result_post = $db->query($query_post);
$one_post = $db->fetch_assoc($result_post);
$full_text = $one_post['message'];
echo '<h3>'.$one['subject'].'</h3>';
echo '<h4>' . date("F j, Y", $one['posted']) . ' | ';
echo '<a href="/forum/profile.php?id='.$one_post['poster_id'].'">'.$one['poster'].'</a></h4>';
// parse BBCode; also convert smiley links
echo str_replace('img/smilies/', '/forum/img/smilies/', parse_message($one_post['message'], 0));
echo '<p class="permalink"><a href="/forum/viewtopic.php?id='.$one['id'].'">Discussion</a> ('.$one['num_replies'].')</p>';
}
// Parting shots
echo '<h2 id="title-also">Also Recently</h2><div class="cleanlist"><ul>';
while($one = $db->fetch_assoc($result))
{
echo '<li class="clearfix"><a href="/forum/viewtopic.php?id='.$one['id'].'">'.$one['subject'].'</a></li>';
}
echo '</ul></div>';
It's one initial query to get the titles and IDs of the threads, and then for each one that's being display in full, there's a second query to grab the text of it. There may be a more elegant solution involving GROUP BY or whatever, but this does the trick for a relatively low-volume site.