tags:

views:

32

answers:

3

I have a parent/child relationship (based on the cck node reference field).

Recipe Group contains a node reference to the type Recipe. It's a 1 to many relationship.

What I need to do is create a view that displays the recipe group information, and then under it, the recipes that have been assigned to it's cck field.

So

RecipeGroup1 - Title Recipe1, Recipe2, Recipe3 RecipeGroup2 - Title Recipe4, Recipe5, Recipe6

etc etc

I've created the view to pull the list of recipe groups.. but I have no idea how to retrieve the recipes that belong to the group?

I've tried googling, but we are on a tight time line and would appreciate any assistance.

Thanks.

A: 

You can use the Views attach module to associate a view with a specific content type and display that view on that content type's node page.

There is a webcast here that demonstrates how the module can solve a problem similar to yours.

However, the webcast assumes your nodereference CCK field is on the child content type and is pointing to the parent content type, not the other way around like you have it.

Instead of using the nid of the recipe group as an argument to the view (as shown in the video) you may be able to use one of the recipe group's tokens (the nodereference field referencing its children). You can see that option at 9:32 in the video.

Whatever you decide to do, I think Views attach will likely be your answer.

CalebD
My problem is that I need to list ALL recipe groups on a single page with the recipes under each group. The group acts like a heading where as the recipes are like a list underneath. In order to facilitate that I created a view that lists the recipe groups out. My problem now is that I have no idea how to pull in the recipes that belong to the groups?
Mike
Wow I am truly a wonder sometimes. I just added the cck reference field to my output and it looped through automatically and displayed a list of all the recipes. I'm hoping that I can now customize the output of the field to include the actual properties that belong to the child element.
Mike
Sorry for wasting your time. Thanks though, as the views attach module and the demonstration will definitely come in handy for other features of the site.
Mike
No problem. Sorry I misunderstood and I'm glad you found your answer.
CalebD
A: 

Include the cck reference node field as an output field to your view. After, you can 'rewrite the output of this field'.. so that it looks however you want.

Mike
A: 
  1. add noderefernce field in to views fileds
  2. select check box to group field result in node ref field settings
  3. theme that field as you want
Igor Rodinov

related questions