I have a function that calls itself to create the following structure for a tree menu.
About
[INDENT]History
[INDENT]Working here[/INDENT]
Careers
[INDENT]Postings[/INDENT][/INDENT]
Investors
[INDENT]Financial
[INDENT]Annual Report[/INDENT][/INDENT]
I need to number the above like below:
About
[INDENT]1.1 History
[INDENT]1.1.1 Working here[/INDENT]
1.2 Careers
[INDENT]1.1.2 Postings[/INDENT][/INDENT]
Investors
[INDENT]2.1 Financial
[INDENT]2.1.1Annual Report[/INDENT][/INDENT]
here is the PHP function that generates the unordered list
function specs($parent_id, $cabinet_id) {
global $_CONFIG;
$db = new DB('mysql');
$db->query("SELECT something semething");
while ($data = $db->results()) {
echo '<ul>';
echo '<li>'.$data['name'].'</li>';
// recall tree on any child ids
// this will delete the family recursivley
specs($data['content_id'], $cabinet_id);
echo '</ul>';
}
}
I have tried several methods but can not figure out how to make the numbering recursive.