When using a book that has more than one content type, then the content type file (print_html.node-type1.tpl.php) is used if you look at a page of type1, but all of the pages are rendered as type1, regardless of what type they are. A good sample book is:

type1
-type1
--type2
--type2
--type2
-type1
--type2
--type2

I am not sure how to correct this behavior, but will look into it. Adding a simple error_log("typeX"); line to the various content-type-specific print tpl.php files will reveal that only one rendering engine is used regardless of actual node content type.

Comments

jshorb’s picture

Note: You must have "Current page and sub-pages" enabled on the Web page->Options panel to see this behavior, I believe.

jshorb’s picture

Another note: I did try to use ConTemplate but it was decided against making this module depend on ConTemplate for displaying custom content types. I think I agree with this position (to avoid dependencies), although it would be good to recognize the difference between "display content differently" (the print module) and "modifying/creating the $content variable." ConTemplate allows for the displayed "$content" variable to be created differently, whereas the print files (print_html.node-typeX.tpl.php) are really more for displaying the $content variable (and any other variables) not manipulation.

I believe all this fix would take is to run the $print['content'] through the standard Drupal core $content creation hook (maybe node_view()?) and then ConTemplate could be compatible with this module (without it being a dependency).

Hopefully that makes sense. I'll continue looking into the source.

Justin

jshorb’s picture

This has been cross-listed in #996582: ConTemplate not respected in Book Hierarchy during export. The two options to fix this are:

  1. Making ConTemplate integrate with the Book module, possibly via an "Export" template.
  2. Making the Print module not use the Book recursive export functions, and rather use its own.

As mentioned on the other thread, I think that using ConTemplate may be the easiest solution that requires re-building less of the core functions within the book module. This does, however, mean that the use of the print[_format][.node-typeX].tpl.php file is not a valid feature of this module, since it isn't recognized within the core book export functions.

I'll leave both of these threads as 'major' and 'active' because there are core-incompatibilities with both Print and ConTemplate when using Book Export.

jcnventura’s picture

Status: Active » Closed (works as designed)

Hello,

Book traversing is a problem that would probably require it's own module. This should actually be a general node hierarchy solution leaving the user to decide how to do the traversal in case of non-tree structures.

All of which is really totally outside the scope of this module.. If you use the core book module to organize your nodes, that module provides the node-traversal algorithm that this module uses. Which mean that any problem with that algorithm need to be fixed there.

João