Vanilla 1 is no longer supported or maintained. If you need a copy, you can get it here.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

extension request: comments displayed as a tree

edited March 2009 in Vanilla 1.0 Help
This must look familiar to you:
suppose I start a discussion and that "someone" answers, and that other answers follows. I'd like to see something like:
--+-- grahack
+-- someone1
+-- grahack
+-- someone2
+-- someone1
+-- someone3
+-- grahack
according to who answers who.
I have some ideas for the implementation and UI but I just needed some advice and extra features from the community.
Or maybe this extension already exists...

This is what this discussion produced

general stuff
  • the creator of a discussion (if allowed by the admin) can decide if his discussion will be threaded or not
about displaying the threaded discussion
  • the discussion displays as usual AND we display the tree at the beginning of the discussion
  • we could collapse away an offtopic branch of a discussion when clicking on the tree, the list of comments would update through AJAX
  • an "answers to" linking inside the page to see the comment this comment is refering to, a "see answers" that popups links of the same type, with the nick of the member who answered
  • when threaded, in fact we don't have the good old "one post per page" UseNet style
about how to reply
  • a reply button on each comment, popping the form for the answer with "in reply to post #12 by TheGuy"
  • the comment box at the end: lots of solutions will it ONLY serve as replying to the thread (well in fact to the first post), or will not be there for threaded discussions, or the user could decide to answer to any post through a drop down list...
  • clicking another "reply to" doesn't close the previous one, the "Add your comments" button that each answer form has will decide which one will be sent to the server
tunnel's examples for nice implementation of threaded discussions: huffingtonpost - dailykos - slashdot


  • Options
    edited September 2007
    Well, I wouldn't personally need this extension, but it would be quite cool.

    My thoughts on the UI would be... have a reply button on comments (obviously) but this when clicked, through the magic of AJAX pulls a new reply box out from underneath the comment. This new reply box which slides out is your entry box to reply to a specific comment and will reinforce that this is the case. The comment box at the end will serve as replying to the thread as normal (or to the last comment?) or will not be there at all.

    Perhaps after a few minutes of inactivity the reply box can hide itself (though this could be awkward if you go for a cup of tea), and if you click reply twice on two different comments, the first comment's reply box can hide itself.

    I think that the threaded comments paradigm can be a little difficult to understand, but if you reinforce it with a "threaded" UI, then it might make more sense to the unwitting user.

    My $0.02. I look forward to seeing what you come up with.

  • Options
    nice ideas, but I think
    - normal reply box shouldn't be there anymore, or would reply to the first post only
    - no timeout for the boxes is needed (except if you give me a good reason)

    problem is: AJAX is not my kingdom at all, but let's continue to think about UI and features...
  • Options
    Personally, I hate threaded discussions. The timeflow breaking up just irritates me as people tend to duplicate a lot of content due to not reading through the discussion. If they want to change the subject, create a new discussion. Looks like you'd need a "Reply" button on each comment. Perhaps just add a new box next to the Whisper box with "Reply to comment number:". Clicking the reply link on a comment would auto fill this box and move the screen down to it.
  • Options
    Experience is speaking through Stash's mouth! Interesting advice about duplicate content. This is like a cold shower for my motivation. But it makes me have other ideas for displaying the topology of the discussion:
    - let's forget the ugly tree for the moment
    - imagine that the display of the discussion is as usual, sorted by time of the comments, but that two links (if needed) are added to comments like in Comment Links.

    an "answers to" linking inside the page to see the comment this comment is refering to,
    a "see answers" that popups links of the same type, with the nick of the member who answered

    this could be smooth and won't break the timeflow

    I thought about such a dropdown (with the # of comments of the discussion) near the whisper box, but found angelic_venus idea better. Anyway, they don't exclude each other, though it's quite handy to see the comment we're answering near where we type.
  • Options
    Can you expand on that revised idea a little? I *think * I understand what you're saying, but perhaps a little mockup would make it completely clear?
  • Options
    edited September 2007
    Sorry I'm not a screenshot master like you are !!! Text only.
    First, note that the page will display as usual so we can see the real timeflow, and won't be reloaded (we'll use internal links).

    If a comment #ans is an answer to comment #qst, let's display a simple link (like "block user", "block comment", how is called this area?) in comment #ans that drives us to comment #qst.

    If a comment #c leads to at least one answer: let's say comment #stash1, comment #grahack and comment #stash2, let's display in comment #c a more complex link like in Comment Links, that will drive us to the right comments.

    Those options don't exclude each other, and if there is only one answer to a comment, the link for it can be simple.

    Is it clearer ?
  • Options
    edited September 2007
    So when writing a comment (which would be the same as now), you would put a comment number in an "Answer comment #:" text field? Or alternatively, click a link in the comment saying "Answer this question"?
  • Options
    Have you ever used Facebook, Stash? In their discussions, you can click "Reply to" on a comment, and when you do, it adds above your post next to your name "in reply to Blah"

    so like "angelic venus in reply to [-Stash-]", then it notifies the user that you are replying to, that they have a reply to their message. I can see where you want to go with this, grahack, having that "in reply to" as a link to the comment it is in reply to.

    You should make sure it integrates well with quoting and stuff, the idea is sound.

  • Options
    Experience is speaking through Stash's mouth! Interesting advice about duplicate content. This is like a cold shower for my motivation.
    Oh no! Don't let you be stopped by that! I love threaded discussions. And can it be that bad? Usenet uses this sort of discussion all the time!

    I'm realy sorry, there are no more threaded forums out there. Would be nice if vanilla could be on of the view "good" ones.

    And no think about it with the power of ajax: you can just collapse away an offtopic branch of an discussion, if you don't like it!

    Tiggr (aka Marcus)
  • Options
    Just because I don't like it shouldn't stop you from doing it, of course not, I just personally *really* hate threaded stuff :D

    I would be interested in the "in reply to" kinda deal that we're also discussing though :D
  • Options
    edited November 2007
    I have been designing and operating forums for 25 years, and it sometimes amazes me that people will still argue about threaded vs conversational (linear) modes. It's an argument as old as the message board itself. Let me toss in a few nickels. Someone will always tell you they can't stand one style or the other. The simple fact is that they are BOTH valid, and like or dislike is usually reflective on the kinds of work someone does, or the nature of the discussion. Linear forums are preferred when a linear, conversational flow is appropriate. But when the subject is technical, or highly faceted, or with many expected opinions, or precise sequence counts, as in question and answer, such flow is completely inappropriate. If issue or question A is on page one, and answer A-1 comes in on page 20, it's not exactly conducive to finding answers or agreement, And nobody wants to wade through countless replies with no proximity to the context. If I am reading a post about apples, and it jumps to pumpkins, pears, and peaches, and want to reply about apples, only "quoting" almost the entire post will give the next reader any context, and you often have to plow through dozens -- or hundreds-- of such posts to come back to apples. Contrast that with a few simple replies to apples, neatly indented under apples, and you can connect the dots and swiftly move on. It's even better when the thread can "collapse" (via javascript). To see the threaded style expressed as comment threads, just see sites like,, or (more complexly) They work well-- and for huge threads. In my experience, whenever a lot of people are discussing serious topics, linear boards like Vanilla quickly become so unworkable, people simply stop posting. But there is no rule. One topic might benefit from threading, and another from linear. If board designers would stop arguing about which is best, and just implement both (as phorum) does, the entire issue would be resolved and people would not have to wonder how to implement them. Many people feel the contention about this topic often comes down to age. Most younger users, they feel, prefer the linear style, perhaps because they are accustomed to the random, free-wheeling discussions on social networks. Older people may be more used to the earlier forums like The Well, Source, and early newsgroups, and they might be more comfortable with the formal, organizational structure of threading. Again, I just think it's context sensitive, and the topic owner or board operator should decide. If Vanilla wanted to make this the most flexible, responsive, kick-ass board out there, they would let the board admin--and/or the thread starter--decide how the replies should be treated. As for implementing threads, just look at a few popular boards that support threads (e.g..wwwthreads, Phorum, MobyThreads, NewBBS), and learn from their experience. Generally, you simply have a reply button on each post. That always creates a reply to THAT post. If the user wishes to reply to the "Parent thread," they use the "New Topic" button at the bottom or top of the list. If you want to be slick, you could have a pull down menu on the rely button, giving users a choice. There are other refinements, such as thread summaries (hybrids) and other techniques. But what matters is the actual database tracking of the thread IDs, not the interface. If someone would simply implement the database scheme for the threading, you could explore a few interface ideas easily. There are several different ways threads can be expressed and acted on, but you can't do any of them without the basic architecture. I have to build a very large site. I will not consider something not threaded. I'd love it if it could be Vanilla, as I like the rest of the product a lot (from what I've seen of it, thus far). So if any Vanilla coder wants to jump on this threading, I would put in prodigious amounts of time to help. Just don't ask me to code it :)
  • Options
    edited November 2007
    Nice (and long) post Tunnel, thanks. I tried to sum up the best ideas (to me) that appeared in this discussion in the first comment.

    I could start something but I'd be happy if someone could point me to a very simple addon that uses new tables in the db (never done this yet).
    I'm also not sure how to structure the new table(s). Things like building trees can need A LOT of resources if badly implemented.

    For the javascript part, I'll look at "comment links" and -?- (write here an extension that pops up a form). Also, the Postback things is still obscure to me, and I guess I'll need it.

    Note that I don't really need this but I find it very interesting, so I don't plan the first serious release in 2007.
  • Options
    edited November 2007
    People interested in doing this should start with Tree-traversal algorithms
    Read the following articles in sequence
    Storing Hierarchical Data in a Database.Simple theory, PHP code and Mysql queries to make it all work. Examples include Adjacency List Model and Modified Preorder Tree Traversal
    Managing Hierarchical Data in MySQL. Awesome simple explanation, with all MYsql query to get you a jump start. Examples include Adjacency List Model and Modified Preorder Tree Traversal

    Once you have read both you will know what are the draw backs of both of these models and why Adjacency List Mode (used by wordpress for comment thread) is slow. Modified Preorder Tree Traversal is better, Fetching a tree is simple and really fast but editing a tree requires the whole tree to be edited making editing costly. Perfect for a Subcategory extension, where you will create a tree once and hardly every change it. There is a NSTREES library to do preorder tree traversal. Another problem with PreOrder tree traversal is that you have to LOCK the table when you are making edits.

    I still have to read up this page.
    Working with Graphs in MySQL
    Combining edge list and "nested sets" algorithms provides a clean solution.
  • Options
    Thank you very much Skiz, that's exactly what I needed. One question with PreOrder Tree Traversal: does the "lock problem" become a real performance problem? I mean, we'll be able to lock the table, but they won't be writable for other actions, only readable right? I think that we read more than we post, so I guess it shouldn't be a big problem for us. At this time, I'd choose "PreOrder Tree Traversal".
  • Options
    edited November 2007
    Well I changed my mind, I'm gonna use Adjacency List Model. I fact I gonna load a kind of php array with parent references for comments with one big query. Data to display (Author, Dates, maybe a little Preview...) are collected at the same time. Since there should be usually less than 200 comments in a discussion, I think that making php handle this array with a recursive function shouldn't be too heavy. Well, we'll see... EDIT: and of course if saves some coding when storing a new comment in the db
  • Options
    edited November 2007
    Hi, I won't have Schizo's success with his Vcal (congrats man), but I wanted to show you the work in progress for threaded discussions. Even if it's ugly and not complete, let's release early and often.


    Work as been done on data structure and browsing only.
    As you can see, a tree is displayed at the top of the discussion with some infos. What you can't see is that answering to... and see answer from... links lead us to the relevant comment on the same page.
    This is a link to my draft.
    here is a better version
    Since you can't reply to a particular comment at the moment, you'll have to enter the test hierarchy manually. But you'll have to install the extension BEFORE tweaking your DB of course.
    On a fresh install you'll have to create a first discussion and several comments.
    When having enough comments:
    UPDATE LUM_Discussion set NoetherThreaded=1 WHERE DiscussionID=1; UPDATE LUM_Comment set NoetherParentCommentID=0 WHERE CommentID=1; UPDATE LUM_Comment set NoetherParentCommentID=1 WHERE CommentID=2; UPDATE LUM_Comment set NoetherParentCommentID=1 WHERE CommentID=3; UPDATE LUM_Comment set NoetherParentCommentID=3 WHERE CommentID=4; UPDATE LUM_Comment set NoetherParentCommentID=4 WHERE CommentID=5; UPDATE LUM_Comment set NoetherParentCommentID=1 WHERE CommentID=6;

    Now that the fun part was done, I wonder if dealing with pagination problems, ajaxing the comment form or reordering the posts in the grid will be difficult or very difficult...

    Now a silly question, except 'ThreadedDiscussions', I don't have a nice name. I went in Noether street on wednesday and thought it could be a nice one...
  • Options
    edited November 2007
    Hi, I've got a working thing now. Many delegates are needed, see at the top of the default.php file. This is a link to the alpha-release.
    Tunnel, I don't know if you're still there but I need some testers.
    Sorry, there is no fancy ajaxy stuff. It's quite raw but it seems to work.
    Now good night and thanks for all advice given here!
  • Options
    @Grahack: I've got requests for such thing in a forum I manage, so I'm going to test it soon and I'll tell you more details.

    Anyway, I still want to have linear mode (but still with 'reply to' possibility) as default and threaded mode only as an option for a user.
    Only some users want the threaded mode. I'm not sure if your add-on allows this, but I'll see when I test it :)
  • Options
    Great news!
    My addon currently doesn't allow user-based choice, choice is only left to the creator of the discussion.
    Known issues: pagination: clicking a link in the index or a search page can lead to weird pages...
  • Options
    so I gave it a first try and it acts pretty buggy on my localhost :) I'm busy so I can't debug it now, but I'll do! :)
Sign In or Register to comment.