[support] Get all nodes in relations with

Carl Wiedemann carl.wiedemann at gmail.com
Fri Nov 5 17:38:30 UTC 2010


This can be done using views relationships. When you create the view, you
need to add a relationship on the nodereference field. Then add an argument
for NID. Configure this argument such that it uses the relationship you
created and that "Provide default argument" is selected with the option
"Node ID from URL." Add a block display for this view.

Here's a screenshot of an example: http://imagebin.ca/view/dxUmsy2K.html

In the example, "Page" nodes can reference "Story" nodes. I want the view to
show "Page" nodes when I am viewing a respective "Story." In the case of
your initial example, "Page" is my content type B and "Story" is my content
type A.

I created a relationship on the nodereference called "Stories."  I added a
NID argument that uses the "Stories" relationship and provides a default
argument that is the NID from the URL. I added a block display and put it in
the region of choice.

The narrative of this view configuration is: "find nodes which have the
given NID argument value in their nodereference field."

Fri, Nov 5, 2010 at 8:43 AM,
ceooph+drupallist at gmail.com<ceooph%2Bdrupallist at gmail.com>
<ceooph+drupallist at gmail.com <ceooph%2Bdrupallist at gmail.com>> wrote:

> Hi list,
>
> I use CCK noderelation to link 2 different contents types.
> I have content type A.
> I have content type B with a nodereference to a content type A node.
>
> When I visit content type A I want to have a block with content type B
> nodes in relation with this content type A node.
>
> What sort of relation and arguments I must use in my view. I find many
> exemples to have the reverse (when I'm on type B, list all type A) but
> it's not that I want.
>
> Thanks in advance for your help.
>
>
> --
> [ Drupal support list | http://lists.drupal.org/ ]
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/support/attachments/20101105/64581193/attachment.html 


More information about the support mailing list