如何在 Drupal 6 - Views 2 中获取相当高级的关系?
我有三种内容类型:艺术家
、艺术品
、展览
。展览有一个字段'artworks'
(无限值)。艺术品有一个字段'artist'
(1 个值,必填)。
我似乎找不到与视图的关系:我想要艺术家曾经参加过的所有展览。这意味着:在艺术家页面上,显示该艺术家曾经参加过的所有展览。
问题(我认为)是一个字段(Exhibition.artworks)有多个值。然而 Artwork.artist 只有 1 值。
我不知道问题是什么=)但它不起作用,我已经尝试了一百万次。此时,我将接受编写 SQL 查询,但 drupal 内容数据库非常不透明,我不知道要查询什么以及如何查询。
显然,我对未受黑客攻击的视图解决方案感到最满意,但我并没有抱太大希望。有人经历过这样的关系吗?
I have three content types: Artist
, Artwork
, Exhibition
. An Exhibition has a field 'artworks'
(unlimited values). An Artwork has a field 'artist'
(1 value, required).
And there is the relation I can't seem to find with Views: I want all Exhibitions an Artist ever participated in. Which means: on the Artist page, show all Exhibitions all Artworks of this Artist were ever in.
The problem (I think) is that one field (Exhibition.artworks) has many values. Yet Artwork.artist has just 1 value.
I don't know what the problem is =) but it's not working and I've tried a million things. At this point, I'll accept writing SQL queries, but the drupal content database is so incredibly untransparent that I have no idea what to query and how.
Obviously I'd be happiest with an unhacked Views solution, but I'm not getting my hopes up. Anyone experience with relations like this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以建立依赖关系来帮助您实现这一目标。在 Exhibition.artworks 上使用关系 (Artwork),在 (Artwork).Artist 上使用关系 (Artwork)
会更容易理解您在导出视图和视图时所做的事情。内容类型。
Drupal 中内容类型的数据库结构工作原理如下:
节点为基表,以nid为索引。您的内容类型有自己的表 content_type_XXXXXX 以及该表的所有单个条目字段(不在内容类型之间共享)成员。多个条目和共享字段都有自己的表 content_field_XXXXXX。所有表都与 nid 字段相关,并且多个条目字段使用“delta”来指示条目顺序。
You can build dependent relationships that should help you to accomplish this. Use a relationship (Artwork) on exhibition.artworks and a relationship (Artist) on (Artwork).Artist
It would be easier to understand what you're doing with exports of the views & content types.
The database structure for content types in Drupal works as follows;
The node is the base table, with nid as index. Your content types have their own tables, content_type_XXXXXX with all single entry fields (that aren't shared among content types) members of that table. Multiple entry and shared fields get their own table content_field_XXXXXX. All of the tables relate on the nid field, and multiple entry fields use a "delta" to indicate the entry order.