Jump to content

Recommended Posts

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


Link to comment
https://forums.phpfreaks.com/topic/297551-ul-li-tags-under-parent-menu/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.