Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

The Ins and Outs of Bulletin Boards

Options
  • 19-09-2002 2:23pm
    #1
    Registered Users Posts: 1,783 ✭✭✭


    Hello,
    I was wondering if any of you people would be able to point me in the direction of some information as to how exactly bulletin boards, like this one, work. I know how to use them and I've been at it for a good while now but I never really managed to find out exactly how they work, i.e. how threads and forum information is stored on the server.

    I'm planning on doing a simple bulletin board for a project. This isn't a "please do my homework for me" request, I'm not after source-code or even documentation to plagiarise, i wouldn't stoop so low and I'm doing this for the learning experience anyway.

    Basically I'm just wondering how they work, what common standards and procedures are used, stuff like that. It's something I've been interested in for ages but just never got around to working on before.

    Thanks.


Comments

  • Banned (with Prison Access) Posts: 16,659 ✭✭✭✭dahamsta


    This site uses vBulletin, which is a big horse of an application that couldn't be described easily. If you ignore the full featureset though - users, private messaging, etc - it's quite simple: Every time someone posts, the data they submit if fired into a database (in this case MySQL) by a scripting language (itc PHP). A simple forum would have two tables, one for threads and one for posts. (It could actually be done with one.)

    If the user is starting a new thread, a new row is inserted in the threads table, and that will return an id; or if the user is replying to a thread, the thread id can be pulled from the POST action. This thread id is stored with the post data, so it can be tied to other posts when it's pulled back out again. Now, when someone calls a URL like http://blah/?thread=1234, the scripting language can select all posts with that thread id, and display them in date order. And when someone replies, it starts all over again.

    That's a rough overview. Now it's time for questions... :)

    adam


  • Banned (with Prison Access) Posts: 16,659 ✭✭✭✭dahamsta


    One other thing -- there are two distinct types of bulletin boards: the "flat" type like this, where all the threads are stored on one flat page, in date order; and the threaded style, where the place people post in the thread is tracked, and posts are laid out in that order.

    Threaded forums are a bit more complex to develop, although they can be more appropriate for certain applications. For an example, see Phorum or the infamous best of breed, Slashdot. Also, if you want to look at the code for a flat-style bb, check out phpBB.

    adam


  • Registered Users Posts: 1,783 ✭✭✭Puck


    Thanks for the info, very helpful!
    I'll probably be using Java Servlets for my board because that's what I know best but PHP looks pretty sweet tbh. I'm not looking to make anything as big as vBulletin (my headaches are bad enough already) but I'll probably go for a "flat" board like this one, it's not as complex as the threaded ones and I personally just like the flat look anyway.

    Now for the questions :) :

    So the thread contents is never written to a file, it's all just stored in a database?

    Would it be a bad idea to try to store threads in actual files?

    About formatting, is that done when the post is submitted and then stored in the database with all the formatting (i.e. html tags) or is it formatted when the request is made to view that particular post?


  • Banned (with Prison Access) Posts: 16,659 ✭✭✭✭dahamsta


    Thanks for the info, very helpful!

    Anytime Puck, that's why I'm here.

    I'll probably be using Java Servlets for my board because that's what I know best but PHP looks pretty sweet tbh.

    It is, but each to his own. Course, ordinarily I'd break into advocacy mode at this point and tell people that PHP is going to rock serious booty when the Zend Engine 2 is released, but I won't do it today, it would be unethical. :) But seriously, you should hack with what you're good at.

    I'm not looking to make anything as big as vBulletin

    Don't. These days you need a team of very clever programmers, a database administrator, a professional designer, a good manager, a truckload of money, and a steady supply of nerf guns to even /gain entry/ to the forums hall of fame.

    (my headaches are bad enough already)

    I know /that/ feeling. Earlier this week I took apart and ultimately /broke/ an app I was working on, being presented as I was with either a blank screen or a page that wouldn't stop loading. Headache? I had to do a demo the next day, I nearly had a coronary. :)

    but I'll probably go for a "flat" board like this one, it's not as complex as the threaded ones and I personally just like the flat look anyway.

    I like both, but you're right, flat is much easier to develop.

    So the thread contents is never written to a file, it's all just stored in a database?

    In the case of vBulletin, yes.

    Would it be a bad idea to try to store threads in actual files?

    No, in fact in the old days (heh), it was the preferred way of doing it, because the two most popular flat boards - Ultimate Bulletin Board and Discus - used Perl as the workhorse. Flat pages were actually necessary, because Perl as a standalone script processor (mod_perl wasn't mainstream) ate resources on the machine. Of course, Java can be run as a module or a standalone server, and it's not as resource intensive, but if you're not comfortable working with databases, flat pages are fine. That's assuming this is just an academic project, obviously. If you're talking about a Real Project, you need to consider scale.

    About formatting, is that done when the post is submitted and then stored in the database with all the formatting (i.e. html tags) or is it formatted when the request is made to view that particular post?

    I'm leaving this one as an exercise, because it should be obvious. But think about it: You need to use regular expressions to format text, right? And regular expressions can be quite expensive, right? ...

    adam


  • Registered Users Posts: 1,783 ✭✭✭Puck


    Since it is only an academic project I think I will use actual files for storing the threads. I have done a project similar to this before, it was a blogger application using Servlets and I plan to use some of the same techniques for this one.

    It's just my opinion but formatting everytime a page is called seems a bit pointless when, with this project, I could just write a file with the formatting in it. Pages may not even be called using a servlet they could just be viewed as static HTML pages but I'm still thinking about the pros and cons of that one.

    Again, thanks for taking time to answer the questions, it's a big help!


  • Advertisement
  • Banned (with Prison Access) Posts: 16,659 ✭✭✭✭dahamsta


    It's just my opinion but formatting everytime a page is called seems a bit pointless when, with this project, I could just write a file with the formatting in it. Pages may not even be called using a servlet they could just be viewed as static HTML pages but I'm still thinking about the pros and cons of that one.

    Well, that was the whole point of generating pages in "the old days", it meant the content was served directly by the webserver, without the overhead of passing through a processor. These days it's less resource intensive, because most processors are built as modules of the webserver. The logic still applies, but less so.

    Also, the formatting thing doesn't really apply with flat pages, as you suggest, it really only comes into play when data is stored in the database. So the answer is "before", because you only have to run the regexes once. However, there is the possibility that you might want to change your formatting codes later.

    adam


  • Registered Users Posts: 761 ✭✭✭Terminator


    Originally posted by dahamsta

    Threaded forums are a bit more complex to develop, although they can be more appropriate for certain applications.

    adam

    They're not too hard to do. You just add two fields to the posts table: depth and order.

    When you reply to a particular post - you retrieve its post depth and post order then give the new post its depth+1 and order+1 (or the number of additional subposts at that branch) and then an order+1 to every subsequent post in the thread.

    To view the posts in the right order just order them by order asc and then tab in for each depth value


Advertisement