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

ainigma32’s picture

Assigned: jmbuytaert » Unassigned
Status: Active » Postponed (maintainer needs more info)

I 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

jmbuytaert’s picture

Hi 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

ainigma32’s picture

Status: Postponed (maintainer needs more info) » Fixed

Thanks for posting your solution.

- Arie

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

johnalbin’s picture

Issue tags: -book, -theming

cleaning up issue tags