Index: book.module =================================================================== RCS file: /cvs/drupal/drupal/modules/book.module,v retrieving revision 1.314 diff -U3 -r1.314 book.module --- book.module 30 Aug 2005 15:22:29 -0000 1.314 +++ book.module 3 Sep 2005 21:28:16 -0000 @@ -485,45 +485,51 @@ } $node->breadcrumb[] = array('path' => 'node/'. $node->nid); - if ($node->nid) { - $output .= '
'; - - if ($tree = book_tree($node->nid)) { - $output .= '
'. $tree .'
'; - } + // Construct the links and titles + $prev = book_prev($node); + $next = book_next($node); + if ($prev) { + $links .= ''; + $titles .= ''; + } + elseif($next) { + // Make an empty div to fill the space only if there are $next links + $links .= ''; + } + + if ($next) { + $links .= ''; + $titles .= ''; + } + elseif($prev) { + // Make an empty div to fill the space only if there are $prev links + $links .= ''; + } + + if ($node->parent) { + $links .= '
'; + $links .= l(t('up'), 'node/'. $node->parent, array('title' => t('View this page\'s parent section.'))); + $links .= '
'; + } - if ($prev = book_prev($node)) { - $links .= ''; - $titles .= ''; - } - else { - $links .= ''; // Make an empty div to fill the space. - } - if ($next = book_next($node)) { - $links .= ''; - $titles .= ''; - } - else { - $links .= ''; // Make an empty div to fill the space. - } - if ($node->parent) { - $links .= '
'; - $links .= l(t('up'), 'node/'. $node->parent, array('title' => t('View this page\'s parent section.'))); - $links .= '
'; - } + if ($tree = book_tree($node->nid)) { + $output = '
'. $tree .'
'; + } + if($links) { $output .= ''; - $output .= '
'; } - $node->body = $node->body.$output; + if($output) { + $node->body = $node->body .'
'. $output .'
'; + } return $node; }