Closed (fixed)
Project:
Drupal core
Version:
6.9
Component:
book.module
Priority:
Critical
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
11 Feb 2009 at 20:50 UTC
Updated:
6 Jul 2009 at 15:23 UTC
Hi,
I'm trying to theme books. I've noticed that there's the file node-book.tpl.php that can be modified, but that changes all of the books. Is there any way to theme individual books? Or maybe a file such as node-book-bookname.tpl.php that can be edited for each book?
Thank for your help.
jm
Comments
Comment #1
ainigma32 commentedI don't think so. You can theme a particular node type (that's what the node-book.tpl.php does) or you can theme a particular page (something like page-node-4.tpl.php)
The problem with books is that they are made up of a series of nodes so you can't target them (easily) by using the node ID and using the node-book.tpl.php will change all books and not just the one you want - as you pointed out already ;-)
The only solution that comes to mind is to create a node-book.tpl.php and use a switch case statement based on the name or ID of the node. It's not a pretty solution but that would get the job done.
If you haven't already I suggest you use the Devel module to find out what kind of templates/functions you can use and what variables are available.
Please post back how that works out for you.
- Arie
Comment #2
jmbuytaert commentedHi Arie,
Thanx for your response. Actually, I found a solution. I created different content types along with individual templates for each one of them.
Then, when creating a page of that particular content type, I got an option of "Book Outline" where I can choose whether it's a new book or if it belongs to a previously created book.
So I now have 3 different content types templates (node-content-type-1.tpl.php, node-content-type-2.tpl.php, node-content-type-3.tpl.php) and a node-book.tpl.php which is pretty much blank.
I hope that helps you in your research. Ask away should you have any other questions.
Regards,
jm
Comment #3
ainigma32 commentedThanks for posting your solution.
- Arie
Comment #5
johnalbincleaning up issue tags