[eluser]ShoeLace1291[/eluser]
Ok, so I've been experimenting with the main controller functions(i.e. Welcome()) and I figured I'd authenticate my users once at the top of the controller. The only problem I ran into is that since the if statement only occurs in the main function, the normal function is still displayed.
For example, if the user visits the index function of the current controller and isn't logged in, the contents of the index function are still displayed, even though the authentication message is there.
Is there a way to stop this?
Example code:
Code:
class Home extends Controller {
function Home(){
parent::Controller();
if($this->member->isLogged == FALSE){
$this->load->view('auth_error');
}
}
function index(){
$this->load->view('index_body');
}
so the problem is, even if the isLogged variable is false, it loads the auth_error view AND the index_body view, and I only want it to load the auth_error view in the case that the user is logged out.
Any ideas?