0

我正在创建 2 种内容类型:“事件”和“演讲者”。一个活动有多个发言人。对于我使用实体引用模块的关系。我想制作一个视图,在其中我可以看到演讲者的信息、图片、.. 有人告诉我也使用显示套件,但我真的不知道为什么我需要这个。最好的方法是什么?

在此先感谢您的帮助!:) 西蒙

4

2 回答 2

0

Yes, you can do this with Views.

But since you're using the Entity relationships, you need to add two relationships in your view. One for the relationship from 'Event' to the 'Entity' and another from the 'Entity' to the 'Speaker'. It's like adding a Many-to-Many join table.

  1. Make a view of Events
  2. Make an Entity relationship between Events and Speakers
  3. Add a relationship between Event and the Entity Relationship
  4. Add another relationship to Speakers that uses the relationship from step 3
  5. Add whatever fields you need from the Speakers nodes.

Hope that helps. I got stuck on that for a long time myself.

The main issue is going to be managing 'duplicates' if you have more than a 1:1 relationship. You might be able to manage that with the "Use Aggregation" feature.

An alternative I came up with for an outdoor activities site I was working on ( http://dev.naturefitter.com/packages ) that avoided the duplication issue was to use Views Field View ( http://drupal.org/project/views_field_view/ ). I created a main view (in my case 'Packages') and a subsequent sub view ('Activities') that takes a contextual filter from the main view. The sub view is a block that has the fields from the Activity content type and a contextual filter that expects the nid from the package content it's attached to.

Best,

Pat

于 2012-08-14T15:52:03.150 回答
0

您绝对可以使用视图执行此操作:在视图中显示引用节点的字段。

创建一个视图来显示您想要从您的事件中获得的所有字段,但是,为了能够为该事件提取适当的扬声器字段,您必须添加该扬声器关系。

  1. 转到视图的“高级”部分,然后单击“关系”旁边的“添加”
  2. 选择“内容:演讲者”或您引用字段的确切名称
  3. 现在您应该能够从字段列表中查看并选择任何“说话者”字段,但请确保在选择其中一个说话者字段时,选择在显示时使用的“说话者”关系。这是字段设置页面上的一个选项。

那对你有用吗?

于 2012-08-09T15:52:06.580 回答