Commit 71da8e0a authored by Dries's avatar Dries

- Fixed a small glitch in book_tree()
parent d85e45bf
......@@ -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>";
......
......@@ -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>";
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment