1

Intro: In the root page of the book, there's an index on the bottom that lists all the child pages. There are also links to previous and next page in each of those child pages. Not sure what the correct terminology is for that index.

My problem: What I would like to do is to completely re-design those links. Since the book contains mostly videos, I want each link to have a thumbnail of those videos. Of course, I would modify the content type of the page to upload that thumbnail image. If I could replace those pages with a panel and a view block for example, that would completely solve the problem. (but not sure if it's possible to create such view to list the child nodes)

Question: Is there a module to redesign those indexes and/or what are the templates I would need to modify to do that? Thanks!

Note: Using Drupal 7. Not a newbie, but not an expert either.

1 Answer 1

0

You actually don't need a module to do this

The previous/next links can be directly modified by 'just' overriding the file modules/books/book-navigation.tpl

<?php if ($has_links): ?>
    <div class="page-links clearfix">
      <?php if ($prev_url): ?>
        <a href="<?php print $prev_url; ?>" class="page-previous" title="<?php print t('Go to previous page'); ?>"><?php print t('‹ ') . $prev_title; ?></a>
      <?php endif; ?>
      <?php if ($parent_url): ?>
        <a href="<?php print $parent_url; ?>" class="page-up" title="<?php print t('Go to parent page'); ?>"><?php print t('up'); ?></a>
      <?php endif; ?>
      <?php if ($next_url): ?>
        <a href="<?php print $next_url; ?>" class="page-next" title="<?php print t('Go to next page'); ?>"><?php print $next_title . t(' ›'); ?></a>
      <?php endif; ?>
    </div>
<?php endif; ?>

this is also described a bit more detailled in this answer to a very similar question:

Next/Previous button for nodes within a book

The book tree is quite a bit more complex.  A good start would probably be to look at the functions template_preprocess_book_navigation and book_children and menu_tree_output and then override the parts you want to 'style' (theme) in your template.php – but that can be tough.

I ran into a similar problem a while ago – and not using the book module was the solution for me. Instead I dived into Entity reference and found it a way more flexible approach than using and theming the book module.

2
  • Thanks. That would solve the previous/next buttons, but the main thing I want to change is the tree itself. In that template the tree is rendered as <?php print $tree; ?> Not sure how I can customize that. Commented Sep 1, 2014 at 22:35
  • ok, I see – edited and updated my answer… Could it be the book module is actually not the right approach? Commented Sep 1, 2014 at 23:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.