ifroz
ifroz

Reputation: 113

Drupal Views of nodes to show node comments

I've encountered a Drupal problem: I'm using the Views module for rendering nodes of a kind, based on the user id of it's author (it is a Content Profile actually). I want the view to show the comments for the node, just like in node/%. I could not find any option in views or any relevant module. Am I in the wrong direction and should reorganize stuff for this...?

Any ideas, how can it be done?

Regards,

Laci

Upvotes: 3

Views: 7770

Answers (4)

Sam Wilson
Sam Wilson

Reputation: 4512

You could create a second view (with URL e.g. /comments/% where the placeholder will be the node ID, and not the comment ID) that lists comments for a given node, with a contextual filter to only show them based on the NID in the URL.

Then, add that view to the footer (as a 'view area') of the single-node view you've already got.

There's some tweaking required for layout (inline fields etc.) but the basic structure should work.

Upvotes: 0

Albert Volkman
Albert Volkman

Reputation: 11

I know this is old request, but I was just struggling with the same issue and came across this post. I thought it'd be helpful to share my solution.

I'm using Drupal 7, with Views 3 and Display Suite.

  1. In your view, choose the display in question.
  2. Under Format, click the first link to the right of 'Show'.
  3. Choose 'Content' (or 'Display Suite' in my case).
  4. Click 'Apply'.
  5. On the next screen, you'll have the option to 'Display comments'. Check this box and save your view.

You should now see the comments displayed under each item in the view.

Upvotes: 1

Igor Rodinov
Igor Rodinov

Reputation: 471

If you use view node display type Check in it's settings show comments if you use view fields display type Use relationship to comments and select fields you need and theme them

Upvotes: 1

googletorp
googletorp

Reputation: 33265

Using views is really not the best plan of action. You should instead create a node template in your theme and customize it. If needed you can put some logic in a preprocess function. It requires more coding but will get you where you want.

Upvotes: 3

Related Questions