FriendsOfSymfony / FOSCommentBundle

Threaded comments for Symfony
http://friendsofsymfony.github.com/
MIT License
460 stars 231 forks source link

Pagination #113

Open merk opened 12 years ago

merk commented 12 years ago

Some people have requested the ability to paginate the comment thread. Need to test if it is a viable thing to provide or not.

merk commented 12 years ago

IRC: @asm89 suggests modification to the Tree class to support incomplete trees of comments, which would make paginating a threaded comment tree easier. Some kind of 'load parent comments' link could also work. The queries are already returning results in a way that can be paginated, depending on the sorters.

Sorters will need to be considered as well.

merk commented 12 years ago

Stage 1 pagination might just involve building the entire comment tree and paginating that array. We could always add more features later, like allowing people who are not using custom sorters to just paginate the query instead.

merk commented 12 years ago

I would appreciate feedback regarding how people want pagination to work.

cbeyer commented 12 years ago

I'm interesting for having pagination in this bundle, because I want to use it for comments (in articles) and for a forum. I only need to display the comments in flat mode (no tree), so I think it should be an easy studie case.

remontees commented 12 years ago

Why don't you implement KnpPaginatorBundle ?

merk commented 12 years ago

Because it will not work for implementing a tree based pagination.

remontees commented 12 years ago

Tree based pagination ? What's this ? And https://github.com/whiteoctober/WhiteOctoberPagerfantaBundle ?

merk commented 12 years ago

Wont work either. Pagination of a comment tree is beyond basic pagination.

remontees commented 12 years ago

I don't understand but I trust. When can we have the pagination ?

simcos commented 12 years ago

is that someone has already started working on a pagination of comments? It would indeed be useful also to allow to display the comments in flat mode (no tree)

merk commented 12 years ago

Noone has been working on pagination at this time. We will accept a PR with the functionality if you wanted to have a go. I will be on #symfony and #symfony-dev later in the day (2 or 3 hours from this post) if you wanted to chat about it.

topwebstudio commented 11 years ago

Why not implement "Load more" like YT pagination, it will be a lot easier.

stof commented 11 years ago

@topweb it does not solve the fact that we are dealing with hierarchical data, and so we need to handle paginating hierarchical data. A Load more link is only a different UI to load the next page, it still requires paginating

merk commented 11 years ago

There already is a Load more link. You can specify a default maximum depth to display which will hide branches of the tree.

tarjei commented 11 years ago

I guess what would be needed to get pagination to work properly, is to move comments to a nested-set implementation so that the paging can be done in the db.

I'm testing an approach now that paginates on roots. I.e select c from Comment where c.ancestors IS NULL limit x, y + then fetch each comments anscestors. This approach isn't perfect and can be much improved but at least it will work :)

merk commented 11 years ago

Moving to such an implementation is not possible, it is a major bc break.

I do not agree that pagination should behave that way when using a threaded view, and should behave more like how reddit behaves.

tarjei commented 11 years ago

 @merk, I'm not sure I completely understand which parts of my comment you reference. I guess you mean that a nested set implementation would be a BC break (which is true).

Wrt to Reddit, an implementation like that is just a question of how you want to show the comments on the next page - i.e. a JS issue, or is there something I didn't understand?

merk commented 11 years ago

In my mind, it isnt possible to paginate a tree of comments. Reddit hides comments after a certain depth (though their algorithm takes into account votes too) and we support that with FOSCommentBundle, with partially loading more comments available as well.

Im not really interested in a pagination implementation that will break bc for existing users, but if you can come up with something simple enough to implement as a choice for users we might be able to put it into a FOSCommentExtra bundle when I move other features not used by most people for v3.0