Hi
I'm about 24 hours into Drupal so please go easy on me.
I've created three books on my site and would like to display a different menu of external links on each.
The menu should appear on both the parent and all child book pages.

I thought I might achieve this by tagging each page in a book with the same vocabulary term and using PHP-mode to determine visibility but can't find any snippets that do this exactly this.

This post (http://drupal.org/node/113651) works on the terms pages but not on book pages tagged with the term.

Any help would be appreciated.

Comments

pogle’s picture

I see now that the link above is the correct one for my requirement.

The problem seems to be that taxonomy_node_get_terms returns an empty array in some circumstances.

The poster here solved it for 4.7 by using the taxonomy_access.module, but that's not available for 6.x.

Is is safe to use the 5.x version or does anyone have any other suggestions?

Thanks.

CloudCuckoo’s picture

Instead of using taxonomy you could instead check that what you're viewing is a node and that node is in a specific book.

Try this as your block visibility code:

  $bid = 2; //The book id.
  $node = menu_get_object();
  return ($node && $node->book['bid'] == $bid);

It will return TRUE if you're viewing a node and the node is in the book with a bid of 2.

The bid (book id) of the book is the nid of the node that is the top level page of the book. So if the parent page is at url node/27 you would set $bid == 27.

pogle’s picture

Believe it or not I was just opening phpMyAdmin to figure out how the book system works.

That's great Cloudy. Many thanks. Simpler and more direct.

stefan81’s picture

@Cloudy
thanks for your input!
How do I show the block on any book page?
(on any page containing to a book)
Thanks