Xtremer360 Posted November 16, 2013 Share Posted November 16, 2013 I'm trying to take my php output and using the HTML nav structure that is currently there turn it into dynamically generated menu using my result set. Any help on helping me figure out how to correct this. Here's my output. array(3) { [0]=> object(stdClass)#24 (3) { ["category_id"]=> string(1) "1" ["category_name"]=> string(9) "Dashboard" ["category_class"]=> string(9) "dashboard" } [1]=> object(stdClass)#24 (3) { ["category_id"]=> string(1) "2" ["category_name"]=> string(5) "Users" ["category_class"]=> string(5) "users" } [2]=> object(stdClass)#24 (3) { ["category_id"]=> string(1) "3" ["category_name"]=> string(5) "Pages" ["category_class"]=> string(5) "pages" ["links"]=> array(2) { [0]=> object(stdClass)#24 (2) { ["item_id"]=> string(1) "1" ["item_name"]=> string(5) "Admin Pages" [1]=> object(stdClass)#24 (2) { ["item_id"]=> string(1) "2" ["item_name"]=> string(5) "User Pages" } } } } I'm wanting to take my php output and using the HTML code below make a dynamic navigation. <li class="active"><a href="" class="glyphicons dashboard"><i></i><span>Dashboard</span></a></li> <li class="hasSubmenu"> <a href="#menu_character" data-toggle="collapse" class="glyphicons page"><i></i><span>Pages</span><span class="icon-chevron-down"></span></a> <ul class="collapse" id="menu_character"> <!-- Components Submenu Regular Items --> <li class=""><a href="">Item 1</a></li> <li class=""><a href="">Item 2</a></li> <!-- // Components Submenu Regular Items END --> </ul> </li> This is what I have so far. <?php foreach ($dashboard_menu_categories AS $category) { echo '<li>'; if (isset($category->links)) { echo '<ul class="collapse" id="menu_'.$category->category_short_name.'">'; /* Components Submenu Regular Items */ foreach($category->links AS $item) { echo '<li class=""><a href="">'.$item->item_name.'</a></li>'; } /* Components Submenu Regular Items END */ echo '</ul>'; } echo '<a href="" class="glyphicons '.$category->category_class.'"><i></i><span>'.$category->category_name.'</span></a>'; echo '</li>'; } ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.