CodeIgniter Forums
calling a controller from another controller. - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: calling a controller from another controller. (/showthread.php?tid=18357)



calling a controller from another controller. - El Forum - 05-04-2009

[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


calling a controller from another controller. - El Forum - 05-04-2009

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

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


calling a controller from another controller. - El Forum - 05-04-2009

[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


calling a controller from another controller. - El Forum - 05-04-2009

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