问题
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...
回答1:
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.
来源:https://stackoverflow.com/questions/3718743/drupal-views-relationships-and-arguments