Hi struggling with this. Was able to get a recursive function to do it with a list.
Now how do I get an multidimensional array of all pages, similar to the nested list.
$children = $site->children()->not('home', 'error', $page);
function doUL($children) {
if ($children) {
echo '<ul>';
foreach ($children as $key => $child) {
echo '<li>' . $child->title() .'</li>';
if ($child->hasChildren()) {
doUL($child->children());
}
}
echo '</ul>';
}
}
doUL($children);
