CodeIgniter Forums

Full Version: calling a controller from another controller.
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]nealumney[/eluser]
Hi Folks,

I have a process which validates whether as user is logged in, or a session has ended (thank you CI for making this very easy). But if the session has ended, or the user is not logged in, I want to re-direct them to a login page. If they are logged in then I want the controller to carry on as if nothing had happened. Is there anyway to use CI to re-direct the user to another controller? Or do I just use standard php to re-direct?

Thanks,

Neal

El Forum

[eluser]Thorpe Obazee[/eluser]
Code:
redirect('controller/method')

You probably need this to redirect them to the login page.

El Forum

[eluser]nealumney[/eluser]
Sorry for being such an idiot!!
Thank you very much for such a quick reply, and yes I do. I did look for this, but just could not find it, still I am learning with every new thing.

Neal

El Forum

[eluser]Thorpe Obazee[/eluser]
I still haven't 'read' everything and I forget things a lot. It's not uncommon (I think).