I've been trying to create a view that shows all sibling pages of this particular book page.

Nowhere do I see such a filter. But there's a relationship that references the book parent, which I then add to a node id argument. So basically now I need some php code to get the parent nid of the child page we're looking at. Any help would be greatly appreciated.

Thanks!

Comments

merlinofchaos’s picture

Does $node->parent contain the data you're looking for? (I don't know much about D6's book so I'm not sure where the data is stored, but it should be on the loaded $node. It always used to be $node->parent but it could have moved with the new system.

Flying Drupalist’s picture

I'll try it, thank you.

kmillecam’s picture

This one's plaguing me too.

In the old Views, there was a place to enter the nid of the parent book page -- not finding that in Views2.

dawehner’s picture

@kmillecam
could you perhaps answer merlins question?

is $node->parent what you want to know?

esmerel’s picture

Status: Active » Closed (fixed)

This issue is a year old; it's likely either figured out or no longer relevant.

Grayside’s picture

Quick answer for searchers: You can create a Relationship on the top-level book page, or the parent page. You can then use that Relationship on an NID Argument to get all sibling pages.

stolzenhain’s picture

Sorry to comment again, but the solution posted in #6 works only for child pages of the current node.

It would be nice to know, if the solution proposed by the original poster (replacing the current NID argument with it's book parent NID) would work somehow in Views 2.

node->parent

doesn't seem to be it. I also tried some searches on the issue but most solutions were tailored for Drupal 5 and earlier.

I tried something like this:

$node = $node_load(arg(1));
if ($node) {
return ($node->parent);
}else {
return;
}

which is probably wrong even if it didn't produce an error, but there has to be a similar solution (as for taxonomy term arguments via PHP). Inserting the parents node as a fixed argument works flawlessly.

Thanks for any hints and sorry for bringing up the issue again!