Views node relationship argument

/ Published in: PHP
Save to your folder(s)

Use this to pull a list of items based on the nid of the 'parent' node.... so you can show fields added to that node, on the child. Handy.

Make nid argument..... use custom php arg code below to feed the argument the nid of the parent.

Remember to change the $ to the field name you are targeting..... IMPORTANT

Copy this code and paste it in your HTML
  1. if (arg(0) == 'node' && is_numeric(arg(1))) {
  2. $node = node_load(arg(1));
  3. return $node->field_proj_parent_ref[0][nid];
  4. } else {
  5. return FALSE;
  6. }

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.