I feel I should know how to do this, but I haven't really had to write a 
function like this yet.

We have a blog site where, currently, users can post entries to their own 
respective blog, and replies can be made to that entry.  Entries are kept in an 
"entries" table, and replies are kept in a "replies" table.  Each reply belongs 
to a parent entry, so "entryId" is a foreign key within the replies table.

I've been tasked with modifying the site so that replies can be made to 
replies, so you can have multi-level threads.  I've done this, by adding 
"parentReplyId" as a column in the replies table.  Each reply still has the 
entryID of the entry that ultimately started the thread to which it belongs, 
but now parentReplyId gives additional info - if this is null, then the reply 
is a "top-level" reply, made to an entry directly, and if it is not null, then 
the reply has been made to another reply.  Now it comes down to writing a cfc 
function that will retrieve an entry's reply nodes in the correct order, 
following each reply down the "tree" until it dead ends and then continuing on 
at the next level up (I'm sure there's a more technical term for this type of 
structure).

So ultimately I'll be able to display reply "A" on the page with its child 
replies indented below it, and any of their child replies further indented 
below them, etc., until there are no more and its on to reply "B"...like how 
you see replies displayed on Daily Kos and Livejournal.  I'm really not sure 
how this is typically done in a CFC function, or if I'm best off with 
returntype query, or returntype array, or if maybe this can be done in a single 
SQL query.  But I've a strong feeling that it's done with recursion.  Help 
please?  Thanks,

Christophe 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:314869
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

Reply via email to