Hi guys, I have this edit_profile function in my site controller and I want logged-in person to edit just their profile (I am storing their ID in session data and comparing them with segment(3)). If IDs match, they can view and edit their profile, if not, they get an error message. My problem is that the error message is not loading header and footer views although I see the error message. I have 3 modules (Login, Site, Home) but my header and footer view are stored in an application/view folder.
PHP Code:
function edit_profile() {
$right_user = $this->right_user();
if ($right_user == true)
{
$this->load->view('includes/header');
$this->load->model('login/membership_model');
$user = $this->membership_model->get_member_details($this->uri->segment(3));
$this->load->view('edit_profile', $user);
}
else
{
$this->load->view('includes/header');
echo 'Nemáte povolení prohlížet tuto stránku. <p>';
echo anchor('login', 'Login');
echo '<p>';
echo anchor('home', 'Home');
$this->load->view('includes/footer');
die();
}
}
I have similar function is_logged_in in my login controller and that one works fine.
PHP Code:
function is_logged_in()
{
$is_logged_in = $this->session->userdata('is_logged_in');
if(!isset($is_logged_in) || $is_logged_in != true)
{
$this->load->view('includes/header');
echo 'Nemáte povolení prohlížet tuto stránku. <p>';
echo anchor('login', 'Login');
echo '<p>';
echo anchor('home', 'Home');
$this->load->view('includes/footer');
die();
}
}
Any ideas?