php - Using die() in functions under CodeIgniter -
i'm writing web application in codeigniter , i'm trying apply user activation.
function is_active() { $active_state = $this->my_model->check_active(); if ($active_state == 'no') { $this->load->view('activation_page'); die(); } }
above code produce blank page , if remove die(); if print out members_area alongside activation_page
so how can force load requested view , exit?
obviously not going inside if statement, meaning if user not active, load activation page.
still don't have else, load view if user active.
try:
if ($active_state == 'no') { $this->load->view('activation_page'); } $this->load->view('members_area');
note: might want revert if condition. looks more logical check if user active, otherwise fallback activation page.
edit:
please refer code: http://paste.laravel.com/pfo
note 2: 1 of many possible solutions.