Page 1 of 1

Dynamic menu creation using php/mysql

Posted: Tue Aug 29, 2006 10:54 am
by swiftguy
Hello Experts,

We are developing an php/mysql application where in we are planning a menu as seen in the following website( http://www.xtrememac.com/ ).The menu options should come from the database(mysql), so basically its dynamically generated menu.. can anybody point me to any good tutorial(creating dynamically generated menu[2,3 level menus] using php/mysql]).Googled a lot but could'nt find a good howto/tutorial for this job :(

plz help me out.

Regards,
Swiftguy.

Posted: Tue Aug 29, 2006 11:20 am
by pickle
Set your database of menu items up so that each entry has link text, a link URL, an id, and a parent id. You can then recursively iterate through each row & build a multi-dimensional array out of the results. So, if an entry doesn't have a parent id set, it's at the top level. If you find a row with a parent id, put it in the appropriate top level element.

Posted: Tue Aug 29, 2006 5:28 pm
by feyd
There's a post in the sticky of Client Side (I believe) that has a link to sitepoint on hierarchical menus that may be of interest.