Topic: An Engineering Class website

I've just switched us to a PunBB/Mediawiki combination from an old phpBB/Coppermine site.

PunBB: http://tron09.com/forum/

I'm pulling posts out of the first forum to create the news on the front page: http://tron09.com/

The usergroup system in Pun allows me to restrict access to certain users, and also appoint a subset as capable of posting to the front page.

I haven't changed the style much except to slap a header and footer on it. But I like the markup layout. I can tell that it won't be a major pain to style it. (Mediawiki was the biggest pain ever, but I beat it into shape...)

Yeah.

Re: An Engineering Class website

Nice! smile

"Programming is like sex: one mistake and you have to support it for the rest of your life."

Re: An Engineering Class website

That looks really lovely but I have a question.

How are you pulling news from forum posts [with comments]?

4 (edited by mikepurvis 2005-09-05 05:40)

Re: An Engineering Class website

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.

Re: An Engineering Class website

Ok great
Thanks for the code!

6

Re: An Engineering Class website

Did you integrate the userbase of punbb with the one of mediawiki? If so, could you please post the mod?