I have this function that generates menu my problem is I have a specific design if there is a parent and when there is none.
{“ITEMS”:{“1”:{“MENU_ID”:”1″,”0″:”1″,”MENU”:”Settings”,”1″:”Settings”,”PARENT_MENU”:”0″,”2″:”0″,”IS_LINK”:0,”3″:0,”MENU_LINK”:null,”4″:null},”5″:{“MENU_ID”:”5″,”0″:”5″,”MENU”:”Views”,”1″:”Views”,”PARENT_MENU”:”0″,”2″:”0″,”IS_LINK”:1,”3″:1,”MENU_LINK”:”page.php?module=09&menu=0d”,”4″:”page.php?module=09&menu=0d”},”6″:{“MENU_ID”:”6″,”0″:”6″,”MENU”:”Plugins”,”1″:”Plugins”,”PARENT_MENU”:”0″,”2″:”0″,”IS_LINK”:1,”3″:1,”MENU_LINK”:”page.php?module=09&menu=0e”,”4″:”page.php?module=09&menu=0e”},”2″:{“MENU_ID”:”2″,”0″:”2″,”MENU”:”Modules”,”1″:”Modules”,”PARENT_MENU”:”1″,”2″:”1″,”IS_LINK”:1,”3″:1,”MENU_LINK”:”page.php?module=09&menu=0a”,”4″:”page.php?module=09&menu=0a”},”3″:{“MENU_ID”:”3″,”0″:”3″,”MENU”:”Models”,”1″:”Models”,”PARENT_MENU”:”1″,”2″:”1″,”IS_LINK”:1,”3″:1,”MENU_LINK”:”page.php?module=09&menu=0b”,”4″:”page.php?module=09&menu=0b”},”4″:{“MENU_ID”:”4″,”0″:”4″,”MENU”:”Menu Items”,”1″:”Menu Items”,”PARENT_MENU”:”3″,”2″:”3″,”IS_LINK”:1,”3″:1,”MENU_LINK”:”page.php?module=09&menu=0c”,”4″:”page.php?module=09&menu=0c”}},”PARENTS”:{“0”:[“1″,”5″,”6″],”1”:[“2″,”3″],”3”:[“4”]}}
The code below is my function that generates the html design of the menu.