Welcome Guest, Not a member yet? Register   Sign In
tree menu & sub-menu using codeigniter
#1

Hey,

SQL structure of
----------------
id,parent_id_menu_name,link_id
-------------------------------
for Social -> Facebook, Google Plus
for Contact -> Email
How to fetch the menu that should represents their sub-menu?

here is the model class:

Code:
<?php
class Model_get extends CI_Model {

// Calling Menu
public function GetData() {
$query = $this->db->get_where('menu', array('parent_id' => 0));
return $query->result();
}

// Calling sub-menu
public function GetParent() {
$query = $this->db->get_where('menu', array('parent_id' => 0, 'id'=> 2));
return $query->result();
}

}

View:

Code:
    <div class="col-sm-9">

           <nav id="desktop-menu">
              <ul class="sf-menu" id="navigation">
             <?php
               foreach($results as $row) {
               $title = $row->menu_name;  ?>

                   <li><a href="#"><?php echo $title; ?></a>



                       <ul>
                              <?php foreach($results2 as $show) {
                                   $sub_menu = $show->menu_name; ?>


      <li><a href="index-video.html"><?php echo $sub_menu; ?></a></li>
      <?php } ?>
                         </ul>



<?php } ?>
 </li>
Reply


Messages In This Thread
tree menu & sub-menu using codeigniter - by waqaspuri - 03-31-2015, 11:00 PM



Theme © iAndrew 2016 - Forum software by © MyBB