I have this array:
$arr = array(
'17-GUIDO HUMBERTO -3 ',
array(
'2-José-3'
),
array(
array(
'18-juan andres-3'
),
),
'17-luis -3 '
);
I have this function:
function listArr($arr) {
$html = '<ul>';
foreach ($arr as $item) {
if (is_array($item)) {
$html .= listArr($item); // <<< here is the recursion
} else {
$html .= '<li>' . $item . '</li>';
}
}
$html .= '</ul>';
return $html;
}
echo(listArr($tree));
Then I add HTML:
<div class="row">
<div class="col-md-12">
<div class="row">
<div id="jstree">
<?php
echo(listArr($tree));
?>
</div>
</div>
</div>
<!-- /.col-md-12 -->
</div>
How can I put 18-juan andres-3
under 17-GUIDO HUMBERTO -3
AND 17-luis -3
under 18-juan andres-3
17-luis -3
Under 18-juan andres-3
Under 17-GUIDO HUMBERTO -3
(This is the top)
How should I put the array to work properly with jstree? Please Help Thanks!!