Got everything working. You can see the results at http://www.cult.ie
Maybe this will be helpful for some people -
I used the following to extract the poster of the most recent topics -
$result_username = $db->query("SELECT u.id, u.username FROM ".$db->prefix."users as u WHERE u.username='".$cur_topic['last_poster']."'");
$user_data = $db->fetch_assoc($result_username);
if (!$user_data['id'])
echo 'Guest';
else
echo '<a href="./forum/profile.php?id='.$user_data['id'].'">'.pun_htmlspecialchars($user_data["username"]).'</a>';
I used the following to extract what forum the post belongs to -
$result_forum = $db->query("SELECT f.id, f.forum_name FROM ".$db->prefix."forums as f WHERE f.id='".$cur_topic['forum_id']."'");
$user_data = $db->fetch_assoc($result_forum);
echo '<a href="./forum/viewforum.php?id='.$user_data['id'].'">'.pun_htmlspecialchars($user_data["forum_name"]).'</a>';
I used the following to display the time of the most recent post -
format_time($cur_topic["last_post"])
Note that I changed the SQL in extern PHP to -
$result = $db->query('SELECT t.id, t.subject, t.last_poster, t.last_post, t.forum_id FROM '.$db->prefix.'topics AS t INNER JOIN '.$db->prefix.'forums AS f ON f.id=t.forum_id LEFT JOIN '.$db->prefix.'forum_perms AS fp ON (fp.forum_id=f.id AND fp.group_id=3) WHERE (fp.read_forum IS NULL OR fp.read_forum=1) AND t.moved_to IS NULL'.$forum_sql.' ORDER BY '.$order_by.' DESC LIMIT '.$show) or error('Unable to fetch topic list', __FILE__, __LINE__, $db->error());
(As you can see it is basically just selecting more items.)
Hopefully this is helpful!!
PS Punbb seems great so far.