I'm using contemplate to theme cck nodes, and attaching cck nodes to the book hiearchy.

However, I can't get the book navigation links to print in the body of a node unless my contemplate is <?php print $body ?> - rather than what I'm using for most cck node types:

<div class="intro-image">
    <?php foreach ((array)$field_photo as $item) { ?>
      <?php print $item['view'] ?>
    <?php } ?>
</div>
<div class="intro">
    <?php foreach ((array)$field_introduction as $item) { ?>
    <?php print $item['view'] ?>
    <?php } ?>
</div>

<div class="news_body">
    <?php foreach ((array)$field_article as $item) { ?>
      <?php print $item['view'] ?>
    <?php } ?>
  </div>

in other words, I can't work out what to ?php print to display normal book navigation links, and it doesn't show up in the example node that contemplate works.

I realised that contemplate shows the last-added book page as the example node - which naturally doesn't have any child pages attached to it, perhaps this is what's causing me the confusion?

Comments

ahneill’s picture

I have this exact problem catch. If someone has a solution, please post the proper code to include Book navigation links for non "book page" content(cck content) that is included in a book hierarchy. This is powerful to be able to include multiple types of content into book hierarchies, but the full navigation is necessary. Thanks, Art.

lovedrupal6’s picture

the solution i got from http://drupal.org/node/265728

replace your contemplate template code with this:

<?php
ob_start(); ?>


// ... PASTE YOUR TEMPLATE HERE......


<?php
$node->content['body']['#value'] = ob_get_contents();
ob_end_clean();

// iterate through each child elements
foreach (element_children($node->content) as $key) {
  // we skip child elements which name preceeded by 'field_'
  if (substr($key, 0, 6) == 'field_') continue;
  // print child element
  print $node->content[$key]['#value'];
}
?>