使用节点引用 +用于创建组合视图的视图
我正在尝试设置一个关系视图,但不知道该怎么做。
这是我要使用节点类型 Artist 和 Song 的示例。
Artist Song Length Bob Dylan Like a Rolling Stone 2:00 Bruce Springsteen Atlantic City 4:00 Burce Springsteen Born to Run 5:24 Van Morrison Domino 3:22 Van Morrison Brown Eyed Girl 4:30
假设我有一个 Artist 节点类型,该类型具有对 Song 的节点引用(设置为无限制)和一个具有附加长度字段的 Song 数据类型,我将如何配置视图来输出此视图?
谢谢! 伊恩
I'm trying to set up a relational View but not sure how to do it.
Here's an example of what I'm going for using the node types Artist and Song.
Artist Song Length Bob Dylan Like a Rolling Stone 2:00 Bruce Springsteen Atlantic City 4:00 Burce Springsteen Born to Run 5:24 Van Morrison Domino 3:22 Van Morrison Brown Eyed Girl 4:30
Assuming I have an Artist node type that has a node reference to Song (set to unlimited) and a Song data type with an additional field for length, how would I go about configuring the view to output this view?
Thanks!
Ian
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这基本上是视图“关系”的参考用例——它们是一种显式拼写连接以在同一视图中拉入不同节点集的方法。
如果我要构建它,我会创建一个歌曲内容类型,其中包含对艺术家的单个节点引用。然后,我将构建一个歌曲视图,其中包括“歌曲标题”和“歌曲长度”字段。然后,我将为“艺术家”节点引用字段添加关系。添加类似的关系后,您可以向视图添加第二个“标题”字段,并指定它应取自艺术家节点而不是歌曲 节点。
This is basically the reference use case for Views 'Relationships' -- they're a way of explicitly spelling out joins to pull in different sets of nodes in the same view.
If I were building it, I'd create a Song content type that has a single node reference to Artist. Then I'd build a View of Songs that includes the 'Song Title' and 'Song Length' fields. Then I'd add a relationship for the 'Artist' node reference field. Once you've added a relationship like that, you can add a SECOND 'Title' field to the view, and specify that it should be taken from the artist node rather than the song node.
这是我在 Drupal 论坛中得到的一个完美运行的答案:
以下假设艺术家是艺术家的标题字段,歌曲是歌曲的标题字段。
使用以下内容创建视图
字段:标题(标签设置为艺术家)
过滤器:节点:已发布设置为“是”,节点:类型设置为艺术家。
您现在应该有一个列出所有艺术家的视图。
在歌曲艺术家的节点引用字段上添加关系,确保 delta 为“全部”。
添加接下来的两个字段时使用关系
字段:节点:标题(标签设置为歌曲)
字段:内容:长度(或任何您所说的字段)
现在在“基本设置”下将样式设置为“表格”。
http://drupal.org/node/825168
Here's an answer I got in the Drupal forums which worked perfectly:
The following assumes that artist is the title field of artist, song the title field of song.
Create a view with the following
Fields: Title (label set to Artist)
Filters: Node: Published set to yes, Node: Type set to Artist.
You should now have a view that lists all artists.
Add a relationship on the node reference field in artist for songs, make sure delta is 'all'.
When adding the next two fields use the relationship
Field: Node: Title (label set to Song)
Field: Content: Length (or whatever you call the field)
Now under "Basic settings" set style to 'table'.
http://drupal.org/node/825168