Jump to content

Commenting system


chrischen

Recommended Posts

I'm trying to create a commenting system that has the ability to nest comments. So basically within the database each comment has a "comment_parent" value pointing to the ID of the parent comment. I use a linked list to organize and return the comments with each child under the respective parent. This works great if I have all the comments on one page. But I need to have some form of pagination and here's where the problem arises. If I paginate by limiting the query then because the child and parent comments may not be together in the database some child responses may be missing if it is not in the query. And if the child response shows up later in a query it will not display because its parent is not there.

 

So basically I need a solution that can display the top level comments by date and show the child and sibling comments while maintaining an X number on each page. And if a child spills onto the next page it should still display.

 

The only solution I have now is to retrieve the top level comments and then have multiple query loops to retrieve each child. But i'm assuming that's not very efficient.

 

Thanks in advance.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.