php - Tree menu - 4 levels -
i have website 4 level menu structure: sections (in sections tabel), categories (in categories tabel, section_id pointing sections) , pages (in tabel pages have parent_id because page can child of page, , each page belong section).
how can build menu? (i use php , mysql) use 4 nested queries. first select sections, each section select categories, , categories select pages without parent, , each page select child pages.
also can use 1 query (with right join) array section_id, category_id, page_id, parent_id. don't know how convert array tree array.
use this class convert query tree array.
it's simple :
$sql_query = "select field1, field2 table field3='val1' , field4=5 or field5='val2';"; $query2tree = new dqml2tree($sql_query); $sql_tree = $query2tree->make(); print_r($sql_tree);
Comments
Post a Comment