Hi folks. I've been struggling to get a view to do what I want. Can anyone with more experience give me an insight into how I can get it to work. Any help would be greatly appreciated. The situation is the following:
I have a node type A, which users can comment on
I would like to create a view to return a list of node titles & summaries of instances of type A owned by a given uid, with the associated comments displayed below each node instance.
So hopefully it would look like this
title1
summary1
- comment1
- comment2
title2
summary2
- comment1
- comment2
- comment3
title3
summary3
- comment1
Everything bar the comments bit is no problem, I just can't work out how to get the associated comments to display.
Any ideas?
Comments
Comment #1
mkalbere commentedUse argument to filter the uid.
Use relationship to get the comments
Use fields to print everything
Comment #2
dawehner#1 seems to be a answer to the question, Thanks.
Comment #3
just_fixed_it commentedThanks guys, much appreciated :)
Comment #4
just_fixed_it commentedSorry guys.
This is really frustrating ... I've tried loads of different combinations and just can't get this to work as I designed above. Everything but the comments is no problem.
Are you sure this is doable with Views? If yes, could you maybe give me a few more hints as to how you managed to do this kind of query by configuring views.
View type: node
argument: uid
relationship???
Any help gratefully received.
Aaron
Comment #5
iamjon commentedjust_fixed_it,
Did you ever get this to work? If yes please update so others can benefit.
If not can you please provide step by step instructions, including a feature or a cck export, as well as an export of the view. That way we can try to replicate and better understand what you're trying to achieve.
Comment #6
just_fixed_it commentedHi there iamjon.
I would have liked to have used Views to do this. In the end it didn't happen. I could not find any documentation specific to my problem, and unfortunately no useful help was forthcoming on this thread. A shame. Maybe the reason for the lack of help on this question is simply because it isn't doable with Views in any non-hacked way. I find that suprising for something that on the surface would appear to be pretty standard, but there we are. It's all water under the bridge now.
After a long time spent digging through the code trying to fathom how things worked under the hood I decided it would be quicker and easier, and would save me valuable time, if I wrote a simple set of php classes to run any general SQL query I wanted and display the results. A bit like reinventing the wheel, but it was such a simple thing that would be needed (SQL wrapper, abstract sql function, Drupal pager, loop on rows, abstract format_row function, encapsulated in a class structure) it was quicker just to write it than mess about. To use it, one simply needs to include the php, and implement a derived class containing the necessary SQL and a format_row function if required. And that's it. Pretty basic stuff really, and not very MVC, but it works a treat for general SQL with a formatted list type style output (like most of my stuff), and it takes minutes to write a new query/formatter instance when needed.
Comment #7
iamjon commentedMarking this as closed. Thanks for the update.