dhimok Posted April 8, 2007 Share Posted April 8, 2007 Hello, Can someone help me with this recursive function. As the function is right now it shows all parents and children. What I want to do is to expend parent to show children and when i click on a child then the menu does not collapse but remains. any ideas? thanks in advance function menu($parent = 0, $level = 0) { // where parent of 0 means it's top-level $retval = ""; $sql = mysql_query("SELECT * FROM " . TABLE_CATEGORIES . " WHERE parent='$parent' ORDER BY sort ASC"); $retval .= "<div id=\"verticalMenu\">\n"; $retval .= "<ul>\n"; while ($row = dbFetchAssoc($sql)) { extract($row); $retval .= "<li><a href=\"".friendlyURL($category_id)."\">" .$category."</a></li>\n"; $retval .= menu($category_id, intval($level) + 1); } $retval .= "</ul>\n"; $retval .= "</div>\n"; return $retval; } Link to comment https://forums.phpfreaks.com/topic/46180-this-tree-menu/ Share on other sites More sharing options...
dhimok Posted April 8, 2007 Author Share Posted April 8, 2007 anyone pls Link to comment https://forums.phpfreaks.com/topic/46180-this-tree-menu/#findComment-224567 Share on other sites More sharing options...
dhimok Posted April 9, 2007 Author Share Posted April 9, 2007 anyone pls! Link to comment https://forums.phpfreaks.com/topic/46180-this-tree-menu/#findComment-224820 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.