When using "Embed Children View:" with "nodehierarchy_children_list" in a Page, the view works perfectly.

If I however create a "Block Display" within the nodehierarchy_children_list View Settings and try to set it as a block (right side), it doesn't work at all.

Duplicating nodehierarchy_children_list isn't working too.

Comments

ronan’s picture

Status: Active » Fixed

That's because views in blocks do not have any context as to what page they are on (or even if they're on a node page). The view cannot therefore tell which node to use as a parent for that block.

This can be worked around by putting this snippet in your view's argument handler php section:

 if (arg(0) == 'node' && is_numeric(arg(1))) {
    return array(arg(1));
  }

Hope this helps
Ronan

Anonymous’s picture

Status: Fixed » Closed (fixed)

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

leisurman’s picture

Component: Miscellaneous » Drupal/PHP Code

Can I open this topic up again? THe code above isnt working. I would like to use the nodehierarchy_children_list in a block and list the children of the current node. I dont want to use menu block because some of the children are not menu items.

How can you make a block know what node it is on? What is the php code?
Thank you

leisurman’s picture

Sorry it did work- i forgot to leave off the opening php tag so you only need

if (arg(0) == 'node' && is_numeric(arg(1))) {
return array(arg(1));
}
?>