Drupal 视图关系和参数
我有一个 Person 内容类型。它有一个公司的节点引用字段,这也是一种内容类型。然后我有一个名为“项目”的内容类型。项目具有对公司内容类型的节点引用。我想列出与人员 ID (nid) 相关的所有项目
如果我将其从视图和 Drupal 中抽象出来,并且每种内容类型都有它自己的表,我会使用类似的东西。
Select ProjectName from Projects where CompanyID IN (select CompanyID from Perons where PersonID = 10)
我可以在视图中做类似的事情吗?
我的 PersonID 将成为一个论点。 这将恢复人员内容类型。然后我会利用关系来复兴公司。
我现在不知道如何将公司与该项目联系起来......
I have a Person content type. It has a node reference field of a company which is also a content type. I then have a content type called Project. A project has a node reference to a company content type. I want to list all the projects related to a person id (nid)
If I abstract this away from views and Drupal and each content type had it's own table I would use something like.
Select ProjectName from Projects where CompanyID IN (select CompanyID from Perons where PersonID = 10)
Can I do something similar in Views?
My PersonID would be an argument.
This would bring back the person content type. I would then use a relationship to bring back the company.
I now don't know know how to link the company up to the project...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这可能不是您正在寻找的答案,但我通常会为双重关系做两件事之一。
完全跳过视图并执行自定义查询。
为第一个关系创建视图。在为此的视图模板中,我将为
2a。只需执行 node_load() 即可拉入第二个关系的节点。
2b.手动实例化另一个视图(通过views_embed_view() 或views_get_view_result())传入正确的参数。
It may not be the answer you are looking for, but I typically will do one of two things for the double relationship thing.
Skip views altogether and do a custom query.
Create a view for the first relationship. Inside the view templates for this, I will
2a. Just do a node_load() to pull in the nodes for second relationship.
2b. Manually instantiate another view (either via views_embed_view() or views_get_view_result()) passing in the proper argument.