[eluser]noideawhattotypehere[/eluser]
If you can make an array from it, gonna store it in database i guess?
id: no need to explain
name: whatever you want to output
parentid: ID of your parent
Code:
public function generate_ul_li($array, $html = '', $parent = 0, $level = 0, $firstloop = TRUE) {
if ($array == NULL) {
return false;
}
$has_children = false;
foreach ($array as $key => $value) {
if ($value['parentid'] == $parent) {
if ($has_children === false) {
$has_children = true;
if ($firstloop) {
$html .= '<ul id="mylist">';
} else {
$html .= '<ul>';
}
$level++;
}
$html .= '<li>$value['name'] </a>';
$this->generate_ul_li($array, $html, $value['id'], $level, FALSE);
$html .= '</li>';
}
}
if ($has_children === true)
$html .= '</ul>';
return $html;
}
call it generate_ul_li($yourarraywithvalues);