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 .= '
';
+ $links .= l(t('previous'), 'node/'. $prev->nid, array('title' => t('View the previous page.')));
+ $links .= '
';
+ $titles .= '
'. check_plain($prev->title) .'
';
+ }
+ elseif($next) {
+ // Make an empty div to fill the space only if there are $next links
+ $links .= '
';
+ }
+
+ if ($next) {
+ $links .= '
';
+ $links .= l(t('next'), 'node/'. $next->nid, array('title' => t('View the next page.')));
+ $links .= '
';
+ $titles .= '
'. check_plain($next->title) .'
';
+ }
+ 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 .= '
';
- $links .= l(t('previous'), 'node/'. $prev->nid, array('title' => t('View the previous page.')));
- $links .= '
';
- $titles .= '
'. check_plain($prev->title) .'
';
- }
- else {
- $links .= '
'; // Make an empty div to fill the space.
- }
- if ($next = book_next($node)) {
- $links .= '
';
- $links .= l(t('next'), 'node/'. $next->nid, array('title' => t('View the next page.')));
- $links .= '
';
- $titles .= '
'. check_plain($next->title) .'
';
- }
- 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 .= '
'. $links .'
';
$output .= '
'. $titles .'
';
$output .= '
';
- $output .= '
';
}
- $node->body = $node->body.$output;
+ if($output) {
+ $node->body = $node->body .''. $output .'
';
+ }
return $node;
}