Welcome Guest, Not a member yet? Register   Sign In
Displaying login data in main-layout
#1

[eluser]Unknown[/eluser]
Hi,

I'm relatively new to CI and currently trying to implement a login into my CI solution. The problem I have is that I want the login to be displayed on all my pages and so it must be a part of my main layout file. Similarly to the official CI page its gonna display a login form if not logged or otherwise the username and that you are logged in.

However i do not wish to have the same code over and over again and so is it possible to load a controller from the main layout? I've a loginController that runs vs my login_model and then determines how login_view should look like.

But all i can think of is running $this->load->view("login/login") in my main-layout which wouldn't run my controller nor my model code but only the view......

Anyone catch my issue?
How can i load the loginController and render its result in the main-layout(index)?




Theme © iAndrew 2016 - Forum software by © MyBB