
Display list with latest Phorum posts
That "Latest forum posts" list on my home page is created with the folowing function
function show_phofum_latest_posts($post_count) {
$cmd = "
SELECT m.message_id, m.forum_id,f.name, m.subject,
FROM_UNIXTIME(m.datestamp,'%d.%M.%Y') as post_date,
u.username, m.parent_id
FROM phorum_messages as m
LEFT JOIN phorum_forums as f ON m.forum_id=f.forum_id
LEFT JOIN phorum_users as u ON m.user_id=u.user_id
WHERE status=2
ORDER BY datestamp DESC
LIMIT $post_count
";
$posts = getRecordsAssoc($cmd);
if( count($posts)!=0 ) {
echo '<h3>'.$post_count.' Lastest forum posts</h3>';
echo '<ul>';
for($i=0;$i<count($posts); $i++) {
echo '<li>';
echo $posts[$i]['post_date'];
echo ' '.htmlspecialchars($posts[$i]['name']).' > ';
echo '<a href="http://forum.salix.gr/read/'.$posts[$i]['forum_id'].'/';
if( $posts[$i]['parent_id']==0 )
echo $posts[$i]['message_id'];
else
echo $posts[$i]['parent_id'].'#msg-'.$posts[$i]['message_id'];
echo '">'.htmlspecialchars($posts[$i]['subject']).'</a>';
echo ' by '.$posts[$i]['username'];
echo '</li>';
}
echo '</ul>';
}
}
show_phofum_latest_posts(5);
Edited 1 time(s). Last edit at 12/27/2006 02:03PM by panos.