Calling controller within view? |
[eluser]Unknown[/eluser]
Hey there! I'm brand new to using a framework, but found CI today and I'm loving it so far. It seems to make development a whole lot easier. I ran into a problem, though. At the top of each page I'm loading my "header" view. This contains my top title and links, etc. I realized I want to have a little control panel on the right side (within this view) that will either display the login form if they're a guest, or options to mess with their account (if they're logged in). I'm not sure how to go about this. I want to simply call the control panel controller (within the view) and that's it. Otherwise, I have to split apart the views and process it on every single controller (in the constructor maybe). Any thoughts on the best way to handle this? -Jason
[eluser]Cristian Gilè[/eluser]
Load a different view for different users. In the controller check if a user is loggedin or not: Code: if($this->auth_lib->is_logged_in()) You can use a master template view like this: template view: Code: $this->load->view('header'); There are different solutions. Take a look at this template lib Cristian Gilè |
Welcome Guest, Not a member yet? Register Sign In |