<?php $rows = array(array(1, 'Ana Sayfa', '#', 0, 1), array(2, 'Tutorials', '#', 0, 1), array(3, 'Java', 'java', 6, 1), array(4, 'Liferay', 'liferay', 3, 1), array(5, 'Frameworks', '#', 0, 1), array(6, 'JSF', 'jsf', 5, 1), array(7, 'Struts', 'struts', 5, 1), array(8, 'Spring', 'spring', 6, 1), array(9, 'Hibernate', 'hibernate', 6, 1), array(10, 'Webservices', '#', 0, 1), array(11, 'REST', 'rest', 10, 1), array(12, 'SOAP', 'soap', 10, 1), array(13, 'Contact', 'contact', 0, 1), array(14, 'About', 'about', 0, 1), array(15, 'TEST-TEST-TEST', 'test', 5, 1), array(16, 'TEST2', 'test2', 15, 1)); foreach ($rows as $row) { $items[] = array_combine(array('cat_id', 'cat_name', 'seo_url', 'parent_id', 'place'), $row); } function draw_menu($items, $parent_id) { echo "\n<ul>\n"; foreach ($items as $item) { if ($item['parent_id'] == $parent_id) { echo "<li>" . $item['cat_name']; // any children? if (count(array_keys(array_column($items, 'parent_id'), $item['cat_id']))) { draw_menu($items, $item['cat_id']); } echo "</li>\n"; } } echo "</ul>\n"; } draw_menu($items, 0);
You have javascript disabled. You will not be able to edit any code.