• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Layout Library Redirecting Problem

#1
[eluser]Gurkan OLUC[/eluser]
Hi All,
I use Layout Library in my project. Evertyhing is okay but there is 1 problem which is the biggest one. I can't redirect with ci redirect() function because page gives me "headers already sent by" error message Sad codes are below,
Code:
<?php
class Users extends controller {
    function Users() {
        parent::Controller();
        $this->load->model('user_model','user');
        $this->load->model('users_model','users');
        $this->load->model('other_model');
        $this->load->library('layout','layout_main');
    }

    //===================================================
    
    # Giriş Yap
    
    function login() {
        $username = $this->db->escape_str($this->input->post('username'));
        $password = md5($this->input->post('password'));
        if ( $this->users->beLogin ( $username, $password )) {
            $userID = $this->user->getUserID ( $username );
            $this->session->set_userdata('user_id', $userID );
            $this->session->set_userdata('username',$username);
            $this->session->set_userdata('login',true);
            if ($this->users->isFirstLogin ( $username )) {
                redirect('users/first_login');
            } else {
                redirect('/main');
            }
        } else {
            $data['message'] = 'Kullanıcı Adınızı Veya Şifrenizi Yanlış Girdiniz!';
            $data['redirect'] = base_url();
            $data['time'] = 5;
            $this->layout->view('message_view',$data);    
        }
            
    }
}

Thanks for help..

Note : before the load system switching I was loading views directly

#2
[eluser]Gurkan OLUC[/eluser]
anyone has an idea? Sad


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.