Hi,
I have a block-view of a ToC of a collection of academic papers sitting in the content section of a top level book page. The page itself is empty but being a top level book page, the book module generates a Toc of all the other pages in the book, as well as 'next' navigation link, and displays them above my ToC block.
Question 1:
I don't need the automatically generated ToC on the site, so I copied the book-navigation.tpl.php file from the modules/book folder into my sites/all/theme folder and deleted the following php snippet:
if ($tree || $has_links):
print $tree;
If I understand correctly, this should have overriden the original tpl.php file and eliminated the ToC from all top level book pages on the site. For some reason, however, it is not working. Drupal seems to have problems sometime reading stuff from my theme folder.
Question 2:
The 'previous', 'next', and 'up' navigation links are very useful for me on all other book pages except for this particular page. How do I hide these links only on this one page?
thanks a million.
Comments
Q1: Have you cleared the
Q1: Have you cleared the theme cache? When you add new template files to a theme folder, you need to get Drupal to reread the theme files by clearing the theme cache. See here: http://drupal.org/node/337176
Q2: Maybe a quick fix would be some CSS a bit like (where 123 is you node id):
But this depends on the theme you're using. Most themes will give an outer div somewhere an id related to their nid.
Thanks for the quick answer
Q1: Yes, I have cleared the cache and still my drupal doesn't see the file. I have one css file in the theme folder which it does see, but the two files (css and tpl.php) which I have added today are not seem to be read into action.
Q2: This sounds good. I am using plain old Garland. Could you tell me how exactly to find the node id, and in which css to put the snippet you pasted?
thanks so much
If you edit your empty node,
If you edit your empty node, your URL should tell you the node ID (unless your pathauto is replacing edit links as well).
The CSS can go in style.css in your theme folder.
Also see my comment on the other thread -- your view doesn't need to be a block if you don't need the navigation links :)
Alan
No joy
I did two things:
1. I added the following to the style.css in themes/garland/
div#node-152 div.content .book-navigation .page-links {
display: none;
}
(my ToC page is mysite.org/node/152)
I then reuploaded style.css to themes/garland.
2. I also uploaded an identical copy of the updated style.css to sites/all/theme/ folder.
I then cleared the data cache in admin > site configuration > performance, and flushed the themes registry (just to be on the safe side).
No change.
Looking at the source code of the page, it does use the style.css from the themes/garland/ folder
but either it did not yet get the updated version from garland, or the div instruction does not work for some reason.
Nor does the page incorporates the sites/all/theme/style.css (it only picks up one out of four files (css and tpl.php which I have in the sites/all/theme folder)
Any ideas?
Look into firebug
Look into firebug (http://getfirebug.com/ for Firefox or http://getfirebug.com/firebuglite for other browsers) to get a great point-and-click interface for viewing/editing CSS. I don't leave home without it. Maybe the elements are inheriting properties from parent elements or maybe the property wasn't defined correctly. Either way, you'll be able to tell exactly what's going in in terms of CSS with this plugin :)
Alan
Good looking utility although I am still not sure what I am doin
Here is the div line when I point in firebug to the list of links (ToC) which the book module generated automatically:
The css which shows on the left hand side is book.css (mysite/modules/book) and the instruction is:
book-navigation .menu {
border-top:1px solid #888888;
padding:1em 0 0 3em;
Q1: So does it imean I need to try to manipulate book.css?
Q2: Is node id then node0152?
Q3: How do I use firebug to troubleshoot the files in my theme utility?
thanks
The CSS snippet I gave you
The CSS snippet I gave you was an example. It would apply on my site but may not on yours. You need to examine the html/css - and firebug is certainly the best way of doing this - to select the html elements you want to hide, while not selecting the ones you want to leave alone.
The #node-NID part of the snippet is just one way of selecting a particular element on a particular page. But you need to look at your own HTML/CSS with firebug to get to the bottom of this.
If this isn't clear, try searching for some CSS/Firebug tutorials
Update - got it right this time
So I finally, through your help I got rid of the Book module's navigation block on the top level book page where my ToC is.
To do this I had to add the following to the book.css in modules/book/ :
div#node-152 .book-navigation .menu {
display: none;
}
(I used the FireBug to identify the css)
This gets rid of the book module's auto generated ToC on node-152 only and leaves the navigation links on the rest of the book pages.
I still don't know why my sites/all/theme folder isn't working. I even tried to upload the updated book.css to the theme folder and then reupload the standard book.css to the modules/book folder. The book.css in my theme should have overridden the one in the modules, but no joy, even after clearing the cache.
Anyway, thanks so much for all the great help. One less thing to worry about.
Where exactly are you placing
Where exactly are you placing the book.css file?
Putting the file in sites/all/theme will have no effect at all. It needs to be in a theme folder and to be called from that theme to be able to work. book.css in sites/all/theme will not override the core css file.
OK
Wherever I looked it was always the sites/all/theme/ folder where you are supposed to put stuff to override core files.
I'll have to read up on it some more.
I don't like changing core files, which is what I did with modifying modules/book/book.css. It means that every upgrade I'll have to do the same change. There's got to be a way to do it and I thought the theme folder was it.
It is. What the last poster
It is. What the last poster meant was that it has to go into sites/all/themes/your-theme-name instead of sites/all/themes. You also need to edit your-theme-name.info in that folder and make sure the CSS file is included.
Alan