A
A
alestro2015-12-21 21:30:00
PHP
alestro, 2015-12-21 21:30:00

How to draw a multi-level menu with an array sorted by the left key nested sets?

There is a table nested sets (id, name, lef_key, right_key, level), I pull out a tree from the database with a query: Then I form an array of objects in a loop:'SELECT * FROM my_tree ORDER BY left_key'

while($row=$sth->fetchObject()){
      $tree[]=$row;
    }

How do I draw a multi-level menu through ul and li.
I've searched a lot of articles on Google, but I haven't found any useful information. Maybe there is some ready-made solution, or for this it is better to use something else, not nested sets, or there is an article describing such an implementation. Thanks in advance.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question