wicky1 Posted July 30, 2015 Share Posted July 30, 2015 Hi, I created the menu using Codeigniter Framework, it works great at websol.biz, unfortunately it returns <UL><LI> in each parent menu, how do I restrict Home and other buttons in a loop OR how to I program accordingly that it should not loop UL LI, tags under parent menu you can see the code samples of my practice. webpage - > websol.biz (live) <!-- Top Bar--> <div class="top"> <div class="row"> <div class="col-sm-3"> <div class="logo"> <a href="index.html"><img src="<?php echo base_url(); ?>public/images/logo.png" alt="" /> </a> </div> </div> <div class="col-sm-9"> <nav id="desktop-menu"> <ul class="sf-menu" id="navigation"> <?php foreach($content as $row) { $title = $row->menu_name; $id = $row->id; $link = $row->link_id; $id_a = $row->id_c; ?> <li <?php $method_name = $this->router->fetch_method(); if ($method_name==strtolower($title)) { echo "class=current"; } ?> ><a href="<?php echo base_url(); ?><?php echo $link; ?>"><?php echo $title; ?></a> <?php echo "<ul>"; for($i=0;$i<count($sub_menu); $i++) { $row2 = $sub_menu[$i]; $id_c = $row2->id_c; $title_c = $row2->menu_name2; $parent_num = $row2->parent_id; $anchor = $row2->link_id; //print_r($row2); //echo "<br>".$title."--id_c = ".$id_c = $row2->id_c; if(strtolower($title)==strtolower($id_c)) { ?> <li><a href="<?php echo $anchor; ?>"><?php echo $title_c; ?></a></li> <?php } else echo ""; ?> <?php } ?> </li> <?php echo "</ul>"; ?> <?php } ?> </ul> </nav> </div> </div> </div> <!-- End of Top Bar--> Database - > http://prntscr.com/7yd6xh Quote Link to comment https://forums.phpfreaks.com/topic/297551-ul-li-tags-under-parent-menu/ 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.