Welcome Guest, Not a member yet? Register   Sign In
role based menu include
#1

[eluser]Unknown[/eluser]
Hi all,

Im new to all this mvc structure so just have a simple question but cant get my head around it!

Basically we have developed our business system in procedural php but now would like to port it to codeigniter.

It operates on a login session based way but the majority of pages include a menu script which is acl based on the role.

e.g. we have a two view templates html_header.php, and html_footer.php these have the header and footer obviously!. On the pages that require the menu in between these we have the menu script, it just generates a list of divs / ul's etc based on the menus they can access.

Basically what im unsure of is how do i go about doing this in ci, id like to create a view for the menu but how does the logic of this become populated, do i create a controller for this and call this from the other controllers or do i create a library or what!!

if it helps here is a little bit of code to demonstrate,
we have a sales controller, within this controller are a search and view method, search shows the results of a query from this point users can see all sales orders and click to open in a new window, at the top of the page is the menu. The view method is just a view and is opened in the new window but does not have the menu at the top. there would be many other controllers, each with their methods again some displaying a menu some not.

Code:
class Sales extends CI_Controller
{
    public function search()
    {
       $this->load->view('html_header');
       $this->load->view('menu');    /*  menu code would this be a controller, or library or .....*/
       $this->load->view('search_sales');
       $this->load->view('html_footer');
    }

    public function view()
    {
       $this->load->view('html_header');
       $this->load->view('view_sales');
       $this->load->view('html_footer');
    }

    public function edit()
    {
       $this->load->view('html_header');
       $this->load->view('menu');    /*  menu code would this be a controller, or library or .....*/
       $this->load->view('edit_sales');
       $this->load->view('html_footer');
    }

}

clearly a lot of logic is missing from these methods but i just need to understand how to get my menus over?!

any help would be greatly appreciated.

Thanks
Jamie


Messages In This Thread
role based menu include - by El Forum - 11-15-2012, 09:25 AM
role based menu include - by El Forum - 11-15-2012, 10:48 AM
role based menu include - by El Forum - 11-15-2012, 11:54 AM
role based menu include - by El Forum - 11-16-2012, 01:56 AM



Theme © iAndrew 2016 - Forum software by © MyBB