Welcome Guest, Not a member yet? Register   Sign In
New to CI (be kind)
#4

[eluser]boldyellow[/eluser]
[quote author="k2zs" date="1287963491"]
Now onto my other issue... How would I make a common navigational item that draws its items from a database?[/quote]

On a school site I did, the nav model goes to the table of the courses offered and grabs the title of each active course to display in the local navigation.

Code:
// Controller
// Asks the nav model to find what courses are active

function courses()
    {
        $data['title'] = "Courses";
        $data['nav_courses'] = $this->nav_model->get_nav_courses();        
        $this->load->view('course_view', $data);
    }

// Model
// DB query to get all active course titles to view in nav

    function get_nav_courses()
    {
        $this->db->order_by('course_name', 'asc');
        $this->db->where('active', 1);
        $query = $this->db->get('course_info');
        return $query->result();
    }


Messages In This Thread
New to CI (be kind) - by El Forum - 10-24-2010, 11:31 AM
New to CI (be kind) - by El Forum - 10-24-2010, 11:55 AM
New to CI (be kind) - by El Forum - 10-24-2010, 12:38 PM
New to CI (be kind) - by El Forum - 10-24-2010, 07:45 PM
New to CI (be kind) - by El Forum - 10-24-2010, 09:32 PM
New to CI (be kind) - by El Forum - 10-24-2010, 10:36 PM
New to CI (be kind) - by El Forum - 10-25-2010, 07:46 AM
New to CI (be kind) - by El Forum - 10-25-2010, 11:44 PM



Theme © iAndrew 2016 - Forum software by © MyBB