Welcome Guest, Not a member yet? Register   Sign In
How to "load" one controller from another?
#1

[eluser]Jakobud[/eluser]
I'm a bit of a CodeIgniter newb, so bare with me...

It seems like a basic question, but I haven't seen anything like this in any tutorials or screencasts. This is what I have:

When you visit my site, it loads the 'site' controller by default. The first thing it does is check if you are logged using session data. If you are not logged in, then I want to goto the login controller. So my question is, how do I "goto" the login controller from within the site controller? I don't see anything in the UserGuide or Wiki about 'loading' controllers.

Do I need to just do a simple redirect?

Code:
header('Location: '.base_url.'/login' );

Sorry maybe this is an obvious question, but I'm having a hard time understanding how some things on a CI site tie together.
#2

[eluser]anthrt[/eluser]
You have the idea right.

Check the redirect function: http://ellislab.com/codeigniter/user-gui...elper.html (scroll to the bottom)
#3

[eluser]Jakobud[/eluser]
Ah that's exactly what I was looking for. Thanks!




Theme © iAndrew 2016 - Forum software by © MyBB