I have seen many PHP function on how to generate a
tag but my array input is quite complicated I guess. It is an array returned from a cust
i didn't test it for variations of the demo data ...
0) {
$out = '- ' . $title . "\n" . '
';
foreach ($cnodes as $cnode) {
$out .= runTree($cnode);
}
$out .= '
' . "\n" . ' ' . "\n";
return $out;
} else {
return '- ' . $title . '
' . "\n";
}
}
$tree = array(
0 => array(
'tag' => 'NavigationMode',
'value' => array(
0 => array(
'tag' => 'Title',
'value' => 'Introduction'
),
1 => array(
'tag' => 'NavigationNode',
'value' => array(
0 => array(
'tag' => 'Title',
'value' => 'Sub Intro'
)
)
)
)
),
1 => array(
'tag' => 'NavigationMode',
'value' => array(
0 => array(
'tag' => 'Title',
'value' => 'Module 1'
)
)
)
);
echo '';
foreach ($tree as $node) {
echo runTree($node);
}
echo '
';
?>