views:

346

answers:

2

I'm making a custom list of nodes and their comments. I'd like to be able to both constrain the number of nodes (easy: Items per page refers to nodes in this case) but also constrain the number of comments displayed per node (e.g. the 5 most recent):

  • Node number one
    • Comment 1-3
    • Comment 1-2
    • Comment 1-1
  • Node number two
    • Comment 2-7
    • Comment 2-6
    • Comment 2-5
    • Comment 2-4
    • Comment 2-3
  • Node number three

So Node number one has three comments. Fine. And Node number three has no comments. Also fine. But Node number two has seven comments; but I only want to show the most recent five.

Is there any way of doing this in Views? It's easy enough to make a view which has the comments in and an argument to provide the node id, were it possible to include such a view inside another view, for example.

I'm brand new to Drupal, so apologies if it's an obvious question. I've googled it, but it's hard to know if you're googling the right thing when you've just started.

Any suggestions appreciated!

Rob

A: 

I can't think of an easy way to do this in views alone. You might need to do a combination of views and a little custom code to get the final result :/

greggles
+1  A: 

according to the views developper here http://drupal.org/node/353872

is almost impossible to do in just one query, and as such is something Views can't support.

however, these modules might be interesting for you: Views Group By or Views Attach and might be a step closer to the solution.

alexanderpas

related questions