Open Source & Stuff  
  |     Main Site     |      Forum     |     Contact     |
PHP scripting :  forum.Salix.gr forum.Salix.gr
PHP resources. You have a problem with a script? you need a script? If you dont find it here feel free to ask. Have something you want to share? post it here!! 
Goto Thread: PreviousNext
Goto: Forum ListMessage ListNew TopicSearchLog In
messageDisplay list with latest Phorum posts
Posted by: panos (IP Logged)
Date: December 07, 2006 11:06AM

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.



Sorry, only registered users may post in this forum.

All Rights Reserved 2006 Salix.gr  |  Design by Ades Design |  Hosting by e-emporio |  forum.Salix.gr powered by Phorum