PHP Dinamik Açılır Menü

0 Cevap php

Here's the situation: I have a menu that needs to be created dynamically from the database. The menu hierarchy is determined by a 'parent' column in the table (each entry has one parent or NULL if it is only a parent)

The problem is that I can't think of how I would dynamically do this, considering I need proper <ul><li><ul><li> structure for my drop-down menu. This requires that I have my 'foreach' of child pages, within the foreach of parent pages? If that makes sense, is there a solution?

Bilginize: Ben getirileri ile çalışıyorum dizisi:

array(31) { 
[0]=>  array(5)
     { ["id"]=>  string(2) "31" ["title"]=>  string(4) "Home" ["linkable"]=>  string(1) "1" ["parent"]=>  NULL ["override"]=>  string(1) " " } 
[1]=>  array(5)
     { ["id"]=>  string(2) "30" ["title"]=>  string(11) "Shop Online" ["linkable"]=>  string(1) "1" ["parent"]=> string(2) "31" ["override"]=>  string(4) "shop" } 

and on and on.

0 Cevap