简体   繁体   中英

Drupal: Sub views?

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.

Take a look at http://drupal.org/project/views_field_view . It lets you combine two views (groups, recipes), inserting the recipes view as a field into the groups view. Using this, you can have as many fields as you want for the group.

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.

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.

  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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM