Way to display those nodes in a view that are related to any other node of a different type

不打扰是莪最后的温柔 提交于 2019-12-11 19:28:45

问题


I have two content types - "Blog" and "News". I am using a reference field to relate blog nodes to news nodes. Now, for the news landing page, I need a block view that displays "Related blogs" i.e. it lists blogs that are related to any news node.

The news landing page is a panel page with a main view that lists all news nodes. The "Related blogs" block will be placed below the main block.

Is there a way to achieve this "Related blogs" block using views?

I am using Drupal7 and I am free to use any module for the relations, apart from references.


回答1:


Just create a new view, add the reference field as a relationship, and the NID as the contextual filter. Also set the contextual filter to Provide a default value and choose Content ID from URL. The add the block to your news pages.



来源:https://stackoverflow.com/questions/10025713/way-to-display-those-nodes-in-a-view-that-are-related-to-any-other-node-of-a-dif

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!