4

I want to create a view that returns all nodes of type X. Beneath each node I want to return the comments for that node as well.

  • Node 1
    1. Comment 1
    2. Comment 2
    3. Comment 3
  • Node 2
    1. Comment 1
  • Node 3
    1. Comment 1
    2. Comment 2

Something like above. Is that possible?

3

Create a new View, Give it a Name

  • Select "comments" for the show option
  • Display Formats should be Unformatted of Fields -- Not Comments
  • Hit Continue & Edit
  • In d7 the content relationship is going to be added for you automatically (just be aware)
  • Add a new field (Content: Title) -- You might want to exclude it from display
  • Under the Format settings there's going to be a Grouping field option, select Content: Title.
  • Save Your View.

That should do it. Sorry is so plain, the views UI is not the easiest to explain, if I tried this post will be insanely long. I try capturing the key details.

Hope this helps.

1
  • The problem with your solution is that your returning the LAST comments (and associate the comment to its node). But not the LAST nodes (and associate their comments). – FR6 Dec 22 '11 at 17:15
0

You may be able to create a comment view (select View Type:Comment when creating the view).

Then add a relationship using Comment:Node, and add the comment and node title fields to the view.

Then set a filter on Node:Type = 'X'.

2
  • Would I not get the the Node title field on each comment? – Jeff May 12 '11 at 15:10
  • I haven't tested, but you might be able to prevent that with grouping options. Or a different approach - create a Node Type view and set a relationship to comments. Either way, you're going to need to make a relationship between node and comment. – pushka May 13 '11 at 10:32
0

You can also create a simple node view and then in the Format section choose show content and then when you get to select the display (Full content, Teaser etc) tick the 'show comments' box.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.