This didn't work, so i tried the following, with a table around it, so that i can add different css style to the td. I can manage everything then, also the indent. I was thinking about a switch and cases, to manage those styles. But i still don't know in which level i am :-(
Could someone help me out please?
Robbie
function show_children($parentid)
{
global $menudb;
global $language_id;
global $site_id;
static $depth=-1;
$depth++;
$padder=str_repeat($depth,' ');
$children = array();
//selecteer alle menuitems van een bepaalde site standaard met -1
$sqlquery = "SELECT menu.id, parent, title FROM menu LEFT JOIN menutitles USING ( id ) WHERE parent = $parentid AND language_id = 1 AND site_id = 2 AND menu.visible = 1 ORDER BY sort_order";
$menudb->SetQuery($sqlquery);
while( $row=$menudb->GetNextRow())
{
$children[] = $row;
}
foreach ($children as $child)
{
if ($child['parent'] != -1) {
echo "<tr><td>";
echo $child['title']."<BR>";
echo "</td></tr>";
}
$depth--;
show_children($child['id']); //zoek alle kinderen en roep deze functie opnieuw aan
}
//var_dump($children);
}
echo "<table>";
show_children(-1);
echo "</table>";