From 71da8e0a8cee51da15b9a6c93ba1b64620218ba3 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Tue, 1 Jan 2002 11:26:29 +0000 Subject: - Fixed a small glitch in book_tree() --- modules/book.module | 8 ++++++-- modules/book/book.module | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'modules') diff --git a/modules/book.module b/modules/book.module index 37b9a2352..1e2a77979 100644 --- a/modules/book.module +++ b/modules/book.module @@ -454,11 +454,14 @@ function book_toc($parent = 0, $indent = "", $toc = array()) { function book_tree_recurse($nid, $depth, $children) { - if ($depth > 1) { + if ($depth > 0) { if ($children[$nid]) { foreach ($children[$nid] as $foo => $node) { $output .= "
  • nid\">". check_output($node->title) ."
  • "; - $output .= book_tree_recurse($node->nid, $depth - 1, $children); + + if ($tree = book_tree_recurse($node->nid, $depth - 1, $children)) { + $output .= ""; + } } } } @@ -476,6 +479,7 @@ function book_tree($parent = 0, $depth = 3) { array_push($list, $node); $children[$node->parent] = $list; } + $output = book_tree_recurse($parent, $depth, $children); $output = ""; diff --git a/modules/book/book.module b/modules/book/book.module index 37b9a2352..1e2a77979 100644 --- a/modules/book/book.module +++ b/modules/book/book.module @@ -454,11 +454,14 @@ function book_toc($parent = 0, $indent = "", $toc = array()) { function book_tree_recurse($nid, $depth, $children) { - if ($depth > 1) { + if ($depth > 0) { if ($children[$nid]) { foreach ($children[$nid] as $foo => $node) { $output .= "
  • nid\">". check_output($node->title) ."
  • "; - $output .= book_tree_recurse($node->nid, $depth - 1, $children); + + if ($tree = book_tree_recurse($node->nid, $depth - 1, $children)) { + $output .= ""; + } } } } @@ -476,6 +479,7 @@ function book_tree($parent = 0, $depth = 3) { array_push($list, $node); $children[$node->parent] = $list; } + $output = book_tree_recurse($parent, $depth, $children); $output = ""; -- cgit v1.2.3