Hi,

is it possilbe (in a views display block) to list fields from a content type "A", that is referenced by a node X(content type "B"), when viewing third node (content type "C", with a node reference to node X - content type "B")?

I'm trying to use views relationships, but i'm only able to show a block with cck "A" fields when viewing cck "b" using arguments "Node id from url".

How can i achieve the same when viewing cck "C" nodes?

Comments

tajabosc’s picture

Status: Active » Needs review

For anyone having this issue you can reference a node of referenced node in a views block.

I've found a solution using views arguments, and this snippet inside php code default argument type:

if (arg(0) == 'node' && is_numeric(arg(1))) {
  $node = node_load(arg(1));
  return $node->field_reference[0][nid];
} else {
  return FALSE;
}

In this way i'm able to get the nid of the referenced node, thus getting all the referenced fields i need.

dawehner’s picture

Status: Needs review » Fixed

Needs review means there is a patch.

That's the way to go here.

tajabosc’s picture

@dereine

Thanks for marking it fixed.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.