Merging books / menus

Events happening in the community are now at Drupal community events on www.drupal.org.
btopro's picture

I'm incorporating a database hack into a module I'm writing (an optional thing) that merges the book and menu outlines. What exactly does this mean? Well, as many of you know in Drupal 6 books work off of the menu architecture (stored in the same table actually). This is why book generated content can be modified by projects like DHTML menus. The issue I have is that I can't structure content in a book and then get a block specific to that book (the way menus does). Also, I can't use book "menus" in projects like Nice-menus and Menu Slice.

Here's the hack.
Create a book
Now create a new Menu (call it whatever)
Open up the database and go to the menu_links table. you should see records that have a menu_name of the form "book-toc-136" or something like that. Copy this text.
Open up the table menu_custom and look for the entry that's the menu you just created. Over-write the menu_name with the menu_name that you copied from the menu_links table.

Ta-dah!

Now you'll have a menu that maps directly to your book. You can now use your books in Nice Menus, make them their own block, add them into primary / secondary navigation of themes and all that good stuff :)

I'll be adding support for this functionality into the Outline Designer module soon so I'll let you know how it goes.

Comments

Excellent tip

Countzero's picture

The post is a bit old, but the tip works perfectly under Drupal 6.15, and I must say it made my day.

I think it would interest people in the book issue queue as the book/menu interaction puzzles many.

Thanks a lot.

Glad it helped

btopro's picture

I wrote a follow up article recently with a video because I got a question about how it worked.

https://elearning.psu.edu/elearning/safely-hacking-drupal-books-act-menus

you made my day man :)

slapierre's picture

thx

Drupal for Evil

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: