3

I wonder if there is any practice when designing a forum. I want to design a couple of forums. yes there are two different types of forum at least. one is for a selective members and another is open for any public members.

In the forum, the member can initiate a thread, then other members can respond to it.

So I have this rough idea for the structure of this type of forums.

I'd name the forum table as 'strings' table. this is the structure I can think of,

str_id        for the auto increment id
str_tilte     for title of the thread
str_content   for content/ text of the thread
str_follow    for you to choose whether you want to follow this thread or not
str_approved  for the admin to approve or reject the thread
parent_id*1     
mem_id        member id who initiates the thread or who responds to the op
cat_id*2
str_created   
str_updated

*1 eg. if the data injection is an op thread then the parent id is itself, if the injection is a response to the op, its parent id is the str_id of the op.

*2 this column is to store the category id of the current data injection. if the injection is a selective forum then it is 1, if the injection is public forum then it is 2.

not sure if I am on the best track, but please let me know if you have any better ideas.

thanks.

edit:

thanks for some reply and suggestions that using phpbb.

just had a look and downloaded phpbb. it is 101% sure that I won't go for it. it is a whole programme like Wordpress or any other PHP frameworks (like Zend). I have an independent framework running this website, so I don't want to run another programme/ framework to mess up the site's backend structure, etc.

if I the site is only a pure forum website, then maybe I would be considering phpbb. but the forum is just a sub feature of a holistic website in my current project.

5
  • 5
    Is there a reason you aren't using already existing FREE forums such as PHPBB?
    – Vic
    Nov 14, 2010 at 21:09
  • 1
    I'd get rid of the str_ prefixes. That gets annoying very quickly the more queries you have to write.
    – Vic
    Nov 14, 2010 at 21:10
  • 2
    @lauthiamkok: I never built a custom forum myself, but i think it would be a good idea to setup a phpBB forum locally and then see how its tables were built. Nov 14, 2010 at 21:11
  • these forums i am going to design is part of a website which has a list of tables. so i want this table of forum to be as simple as possible to sit together with other tables. i don't know how complicated the table in PHPBB - it may has lots of tables like other free forums available out there which are not my favourite thing to integrate it with my website. thanks.
    – Run
    Nov 14, 2010 at 21:15
  • @lauthiamkok: When i meant "see how phpBB tables were built", i never intended to just copy them, but to look at them as a good reference. Nov 14, 2010 at 21:43

3 Answers 3

10

Don't start with a table, start with a conceptual ER Diagram of your base entities, forums, threads, replies,members, keywords, categories etc. and express the relationships first.Then get into logical design mode and define the tables needed to implement the functionality. As suggested have a peek at the way phpBB tables are organized.

I like to do my first diagram on a printing whiteboard or on paper then move to a diagramming tool for logical design.

I think there's still some room for a 'better' forum, so good luck.

5

Greetings.

As i previously recommended in comments to your question.

I strongly recommend you to set up local installations of other open source database driven forums in your machine, in order for you to have a strong idea and base of what other developers did when they develop such forum applications, not just looking at the database tables but also to the code, organization and design of the forum. I think it proof it self very useful to open your eyes to possibilities for your own forum application

A few examples of database driven forums:

I usually say the best way to learn is trial and error but let me also point out. Even this forum application your creating, its just for small and private use for your websites.

You should consider that your forum application one day may become popular and you might desire to turn it public like these previous ones mentioned, or you just want to add some new features.

In this case i suggest you plan your Code and Database Architecture very well, planning ahead for future upgrades.

Also you should take MikeAinOz advice very seriously in his answer and start by

Conceptual ER Diagram of your base entities, forums, threads, replies,members, keywords, categories etc. and express the relationships first.Then get into logical design mode and define the tables needed to implement the functionality

Thats the best answer to this kind of question i ever seen.

Regards & Good Luck.

0
2

My thoughts...

  1. str_follow shouldn't be in this table. It should have its own table that links members to subscribed threads.

  2. I'd recommend having parent_id null if its a top level thread, it makes more sense.

Not the answer you're looking for? Browse other questions tagged or ask your own question.