summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2002-01-01 11:26:29 +0000
committerDries Buytaert <dries@buytaert.net>2002-01-01 11:26:29 +0000
commit71da8e0a8cee51da15b9a6c93ba1b64620218ba3 (patch)
treee20ef67217d51420514d63670e3d89ad2fabb57e /modules
parentd85e45bf64cb2715f116eae1e0ea422419c0a358 (diff)
downloadbrdo-71da8e0a8cee51da15b9a6c93ba1b64620218ba3.tar.gz
brdo-71da8e0a8cee51da15b9a6c93ba1b64620218ba3.tar.bz2
- Fixed a small glitch in book_tree()
Diffstat (limited to 'modules')
-rw-r--r--modules/book.module8
-rw-r--r--modules/book/book.module8
2 files changed, 12 insertions, 4 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>";
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 .= "<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>";