Drupal:子视图?
我有父/子关系(基于 cck 节点引用字段)。
配方组包含对类型配方的节点引用。这是一对多的关系。
我需要做的是创建一个显示配方组信息的视图,然后在其下方显示已分配给其 cck 字段的配方。
所以
RecipeGroup1 - 标题 配方1、配方2、配方3 RecipeGroup2 - 标题 Recipe4、Recipe5、Recipe6
等
我创建了视图来拉取菜谱组列表。但我不知道如何检索属于该组的菜谱?
我尝试过谷歌搜索,但我们的时间紧迫,希望得到任何帮助。
谢谢。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
查看http://drupal.org/project/views_field_view。它允许您组合两个视图(组、菜谱),将菜谱视图作为字段插入到组视图中。使用此功能,您可以为组添加任意数量的字段。
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.
您可以使用视图附加模块将视图与特定内容类型关联并在该内容上显示该视图类型的节点页面。
这里有一个网络广播演示该模块如何解决与您类似的问题。
但是,网络广播假定您的 nodereference CCK 字段位于子内容类型上并指向父内容类型,而不是像您那样相反。
您可以使用配方组的标记之一(引用其子项的节点引用字段),而不是使用配方组的 nid 作为视图的参数(如视频中所示)。您可以在视频中的 9:32 处看到该选项。
无论您决定做什么,我认为附加视图可能就是您的答案。
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.
将 cck 参考节点字段作为输出字段包含到您的视图中。之后,您可以“重写该字段的输出”......以便它看起来像您想要的那样。
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.