Drupal 6: get parent nid of a book child page
Submitted by fabio on Fri, 2008-06-27 18:07.
I had to get the parent nid of a book child page for a website which already uses Drupal 6.
Seems that the book module logic has changed deeply between version 5. The new stack implementation of the parent-child relationships is pretty complex, at least for me. I have to say that I did not studied it a lot thought.
So.. this is the code to do that:
<?php
if(isset($node->book)) { // book page
$parent = book_link_load($node->book['plid']);
$pid = $parent['nid'];
}
?>
Hope this helps.
- fabio's blog
- 485 reads
Posted in:

Post new comment