Welcome Guest, Not a member yet? Register   Sign In
Trying to load an error view - other views being loaded also
#1

[eluser]cdonate[/eluser]
Hi, guys!

I'm having a few problems with error handling. I have this function inside my controller:

Code:
function resendActivation(){
  
  $this->load->view('resendActivation_view');
  
  $email = $this->input->post('username');
  
  if($email){
   $this->load->model('membership_model');
   $dados = $this->membership_model->getDados('email_address',$email);

   if(count($dados) == 0){
    
          $data['main_content'] = 'noEmaill_view';
          $this->load->view('includes/template', $data);
          return('');
    
   }else{$this->sendEmailConf($dados->name, $dados->last_name, $dados->email_address);}
}
}

If the user inputs an e-mail that isn't on my DB, the second "if" is trigered and an error view is loaded.

But, what I'm getting is this view
Code:
$this->load->view('resendActivation_view');
and then this view
Code:
$data['main_content'] = 'noEmaill_view';
$this->load->view('includes/template', $data);

All in the same page, one beside the other. Why is this happening? What should I do to load an error page and staying there?

Thanks!




Theme © iAndrew 2016 - Forum software by © MyBB