I have seen many PHP function on how to generate a <ul><li> tag but my array input is quite complicated I guess. It is an array returned from a custom function called xml2assoc
My question is how can I convert the returned xml2assoc array result to a <ul><li> formatted HTML code using PHP.
Thanks.
$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' ) ) ) );
The final output that I need to generate is like this:
<ul> <li> Introduction <ul> <li>Sub Intro</li> </ul> </li> <li>Module 1</li> </ul>
i didn’t test it for variations of the demo data …