By jakonore on
Hello everybody,
Usually I figure everything by myself but is there someone that knows which variable I should use to print the book navigation in my theme?
I have a node-custom.tpl.php in which I want to print the book navigation but I don't know how.
when I write "php echo $content; " the navigation show with all the content, but as I want to have special html markup I need to print only the navigation from the book.
Thanks in advance for your help!
Comments
_
There's no variable for the book navigation block but the book_block code is in book.module. You should be able to copy it into your own module or custom block and adjust as desired. Another option might be to just alter the book-navigation.tpl.php file as needed (copy to your theme directory before editing it).
Ok, I'll try and let you know
Ok, I'll try and let you know if it works !
Thanks
Here is the variables I found
Here is the variables I found in the book-navigation.tpl.php file :
Available variables:
* - $tree: The immediate children of the current node rendered as an
* unordered list.
* - $current_depth: Depth of the current node within the book outline.
* Provided for context.
* - $prev_url: URL to the previous node.
* - $prev_title: Title of the previous node.
* - $parent_url: URL to the parent node.
* - $parent_title: Title of the parent node. Not printed by default. Provided
* as an option.
* - $next_url: URL to the next node.
* - $next_title: Title of the next node.
* - $has_links: Flags TRUE whenever the previous, parent or next data has a
* value.
* - $book_id: The book ID of the current outline being viewed. Same as the
* node ID containing the entire outline. Provided for context.
* - $book_url: The book/node URL of the current outline being viewed.
* Provided as an option. Not used by default.
* - $book_title: The book/node title of the current outline being viewed.
* Provided as an option. Not used by default.
EDIT :
And here is the code I found in book.module that I guess deals with the navigation :
function book_theme() {
return array(
'book_navigation' => array(
'arguments' => array('book_link' => NULL),
'template' => 'book-navigation',
)
/edit
So I tried to use them in my node-custom.tpl.php but there isn't any of them that is rendering something...
I guess I'm missing something because It's the first time I face this kind of problem.
If anyone has an idea...
_
Those variables are not available to node.tpl.php-- they're available in book-navigation.tpl.php.
Ok, and is there a way to
Ok, and is there a way to make them available to node.tpl.php? or is it impossible?
Solved
Ok, I found how to do it.
Thanks to the devel module, I found the path to the variable and print it with the following code :
print $node->content['book_navigation']['#value']