Welcome Guest, Not a member yet? Register   Sign In
Navigation menu from database
#2

[eluser]mikemiller[/eluser]
You need to pass the data required by the navigation view into the top level view to then pass into the nav view.

Controller code:
Code:
<?php

class Test123 extends CI_Controller {

    public function test() {
        $this->load->model('menu');
        $data = array();
        $data['menu'] = $this->menu->getMenuItems();
        $this->load->view('template/{whatever top level view is called}', $data);
    }
}

View code:
Code:
<?php $this->load->view('template/header'); ?>
<?php $this->load->view('template/navigation',$menu); ?>
<div id="page-wrapper">
    <div class="row">
        <h1>Title</h1>
    </div>
    <div class="row">
        <p>Paragraph</p>
    </div>
</div>
&lt;?php $this->load->view('template/footer'); ?&gt;

Your data array would also need to hold the info for the top level view and anything you need to pass into the template views


Messages In This Thread
Navigation menu from database - by El Forum - 09-02-2014, 07:32 AM
Navigation menu from database - by El Forum - 09-02-2014, 10:46 AM
Navigation menu from database - by El Forum - 09-02-2014, 11:22 AM
Navigation menu from database - by El Forum - 09-02-2014, 11:23 AM
Navigation menu from database - by El Forum - 09-03-2014, 08:02 AM
Navigation menu from database - by El Forum - 09-08-2014, 01:36 AM
Navigation menu from database - by El Forum - 09-12-2014, 02:24 PM



Theme © iAndrew 2016 - Forum software by © MyBB