By ss_drupal on
The book module is written to see if there are any children of the current page, and if so print out a list of links to the child pages in a sort of navigation menu with a top border on it's enclosing DIV.
I would very much like to precede that list with something like:
<div class="booknavtitle">Subsections</div>
... inside the navigation DIV itself, so it falls within that top border on the Book navigation DIV.
I've been poking around at the innards of the book module. I haven't however been able to figure out where to insert the code to do this.
I would be very greatful if someone could steer my attention to the right spot.
Thanks for reading.
Comments
Copy the file
Copy the file book-navigation.tpl.php from the book module folder to your theme folder, and then edit this copy to include the markup you want. Then flush the theme cache.
Thanks, but ...
Thanks, but actually that can't work.
The relevant lines in that file say:
So using that with this example:
AAAAA would print above the navigation DiV, and above the enclosing upper border.
BBBBB would print below the navigation links.
I think I need to find the place where $tree is converted into HTML -- where the actual DIV tag is generated in order to get between the opening DIV tag and the opening UL for the list.
Thanks again.
Huh?
So the AAAAA prints BEFORE the navigation DIV generated by the line ABOVE it in the template file? I'm pretty sure that's not how it works. But if the javascript thing works for you... cool.
Tested it before posting data
I tested it myself before posting this whole subject.
It seemed the natural way to go.
Easy to test if you want to verify.
OK. For them what comes behind me ...
The only practical way to make this happen is to add a list item to the beginning of the list with javascript.
I did it from drupal.js using jquery.
You can then style your addition from your regular theme css.
Use CSS to change where the line is!
Sillyness! - adding javascript is going way over the top. Using Firebug in Firefox will shown you that the line is applied to ul, not a containing div, and that is why added text appears above the line.
Comment 3180164 was correct. Copy book-navigation.tpl.php to your theme and adjust as needed.
There are many variables available, listed in the file, so you have many customization options. Here's an example that displays a title above the list for a specific book and only on the parent page:
Above the "print $tree" line:
To 'fix' the text appearing above the line, add the following to your theme's css file: