Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Interactive forum -> how to create?

Status
Not open for further replies.

Bramvg

IS-IT--Management
Jan 16, 2001
135
BE
Hi,

My question is about interactive forums.

It's a very 'normal' forum like this:

- Message 1
- reply 1 on message 1
- reply 2 on message 1
- reply 1 on reply 2
- reply 2 on reply 2
- reply 1 on reply 2
.....


--------------------------------------------------
My question is:

Question 1.
How do I organize my database? (Ms Access)
I thought that I needed to create 2 tables.

Table 1:
----------

ID
Category name

Table 2:
------------
ID
ID category [link with category]
Level Number [Is it a reply on a reply/....] = how is it linked with
the category
Subcategory name


Question 2.
How do code this in ColdFusion that my scripts knows how to group
it all and present it in a 'tree structure', one 'problem' is that I know
how to do it when theire is only 1 subcategory, but once I have a reply on reply
I don't know how to organize it :-(

Question 3.
How do I create my updater / insert form?


Can someone help me or does anyone knows about a reference to an article
where I can find this?

tnx and with kind regards
bram




 
Bramvg,

Question 1
----------
Level Number is not essential but may be handy to help you with the output page layout.
To keep track of what's a reply to what you need to define the Messages table as:
MessageNum (primary key)
CategoryCode
MessageText
ParentMessageNum (optional; if used, must = a MessageNum)
any other fields, e,g, DateFirstPosted, DateOfLastResponse, AuthorId.

This type of structure, with a relationship between 2 fields in the same table, is commonly used to represent hierarchies. But it needs to be used carefully:
* to read the table you need to write recursive code to find the replies. So I suggest 1 CF file to find the top-level messages based on category, date of last posting, etc.
and onther one, called by the first for each top-level message, which finds the level N responses and, for each one, calls itself to find the level N+1 responses, etc.
* performance will not be brilliant because you need to run so many queries to list messages.
* you'll probably want to limit the number of levels, to minimise the perfomance impact and to avoid falling off the right-hand edge of the page.

Perhaps you should consider allowing only 1 level of response message, as Tek-Tips does, i.e. you can't respond to a response, only to an original message. If you display message numbers, users can still refer to other people's responses if they wish.

The rest
--------
I suggest you look at that the wonderful Webmonkey( - select category "Programming - ColdFusion) then type "forum" in the search box - there's an artcile there, with sample code to download (I'm reading it now). I also recommend you bookmark Webmonkey - it's full of articles on how to design various CF apps (e.g. shopping cart) and lots of other good stuff.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top