I tried a search for something like this since I figured it would've come up by now; to my surprise, it hasn't. It's either that or I'm horrible at using Drupal's search.

Basically, I'm looking for a little PHP snippet to put into a page node that will print out a table of contents (node and all children) for a specified book node. It would basically be a fully expanded version of the dynamic book navigation block for a specific book. A handy little extra would be a variable to set the number of levels deep to transverse the tree, 0 for unlimited.

I'm not a PHP programmer so I can't pull this off myself so I would love some help on this. I also think it would be a great addition to the Drupal PHP snippet library.

Thanks for reading,
Nick

P.S. I know this is the "How do I" section, but it felt sort of weird putting this in the Modules section. If a moderator thinks it would get better responses over in that forum, please move it.

Comments

wellsy’s picture

http://drupal.org/node/23232

you need to setup all the pages into a certain taxonomy term first though.

There are other places to look and learn how to do that.

wellsy

orchidsonline.com.au

NickHBO’s picture

I was hoping to avoid doing all that. It seemed like an inelegant solution because of what the book navigation block can do. Thanks for the suggestion though.

Nick

coreyp_1’s picture

http://drupal.org/node/44648

This snippet is given for a block, but it can be used in a page as-is.

NickHBO’s picture

I also caught this snippet but since it was in the block section I didn't pay much attention to it. I didn't know you could cross-breed the block and page snippets so I didn't.

Thanks for pointing this out, it worked just how I wanted :)

Nick

JimK’s picture

Nick- This block snippet give a great table of contents for the whole book when inserted into a page. Have you had any success being able to gbet it to print from the 'print friendly' link at the bottom of the book page. All mine shows is the php code in this form, not the table of contents viewed on the page iself.
www.cpnhelp.org