diff options
author | Dries Buytaert <dries@buytaert.net> | 2002-01-01 11:26:29 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2002-01-01 11:26:29 +0000 |
commit | 71da8e0a8cee51da15b9a6c93ba1b64620218ba3 (patch) | |
tree | e20ef67217d51420514d63670e3d89ad2fabb57e /modules/book.module | |
parent | d85e45bf64cb2715f116eae1e0ea422419c0a358 (diff) | |
download | brdo-71da8e0a8cee51da15b9a6c93ba1b64620218ba3.tar.gz brdo-71da8e0a8cee51da15b9a6c93ba1b64620218ba3.tar.bz2 |
- Fixed a small glitch in book_tree()
Diffstat (limited to 'modules/book.module')
-rw-r--r-- | modules/book.module | 8 |
1 files changed, 6 insertions, 2 deletions
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 .= "<li><a href=\"node.php?id=$node->nid\">". check_output($node->title) ."</a></li>"; - $output .= book_tree_recurse($node->nid, $depth - 1, $children); + + if ($tree = book_tree_recurse($node->nid, $depth - 1, $children)) { + $output .= "<ul>$tree</ul>"; + } } } } @@ -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 = "<ul>$output</ul>"; |