Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 11-26-2004, 12:45 AM   #1 (permalink)
sitri
Registered User
 
Join Date: Nov 2004
Posts: 3
sitri is on a distinguished road
Trees and Nodes

For educational purposes I'm coding a simple forum, I've got the login/register, add message, view message, reply etc all figured out. What I'm having problems with is the threading of messages.

eg.

RootMessage
...Reply-1
...Reply-2
......Reply-2.1
...Reply-3
......Reply-3.1
.........Reply-3.1.1
(...)
...Reply-n


One possible solution I thought of is to use a Tree sort type algorithm - which is where I seem to be getting stuck.

Does anyone know how to do this or point me in the right direction so that I can work it out for myself.

TIA

Pual
sitri is offline   Reply With Quote
Old 11-26-2004, 04:35 AM   #2 (permalink)
redhead
Newbie
 
redhead's Avatar
 
Join Date: Jun 2002
Location: Denmark
Posts: 1,692
redhead is on a distinguished road
A thought on this, not that it is a solution...
In the database structure, you could have reply_id and when posting this would hold the ID of the message/reply it is a reply to, then when selecting the current message/reply you would fetch all post with reply_id set to the current ID, and display it.. Altho I havn't given any thought to how this form of infinite loop in infinite dimensions should work.
__________________
Don't worry Ma'am, We're university students, We know what We're doing.
-----
If you pull the pin, Mr.Grenade would no longer be your friend.
-----
01000111 01101111 00100000 01000011 00100000 00100001
redhead is offline   Reply With Quote
Old 11-28-2004, 02:43 PM   #3 (permalink)
idx
Senior Grasshopper
 
idx's Avatar
 
Join Date: Jun 2003
Location: FL
Posts: 317
idx is on a distinguished road
I did something similar with a phonelist system that has unlimited categories. From what I remember, I had a set of functions that ended up calling themselves until the tree was complete.

-r
idx is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -8. The time now is 06:16 PM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0 RC8





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting