Welcome Guest, Not a member yet? Register   Sign In
$this->data, server error?
#1

[eluser]solid9[/eluser]
Don't know the reason,

Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');



class Main extends CI_Controller {

public $data['header'] = $this->load->view('header', null, TRUE);

public function __construct() {
  parent::__construct();

  $this->load->helper('form');
  $this->load->helper('html');
  $this->load->helper('url');    
  $this->load->library('ion_auth');
  $this->load->library('session');
  $this->load->library('form_validation');
  $this->load->database();

  //$this->load->model('prod_m');
}

public function index()
{
  if (!$this->ion_auth->logged_in())
  {
   //redirect them to the login page
   redirect('main/login', 'refresh');
  }
        }

//log the user in
function login()
{
  $this->load->view('front_page', $this->data);
}
}


Can you spot the not of $this->data ?

Thanks.
#2

[eluser]keevitaja[/eluser]
Code:
public $data['header'] = $this->load->view('header', null, TRUE);

you can't call $this outside method...
#3

[eluser]Jason Stanley[/eluser]
You should post the actual error.

Anyway, the problem is caused here.

Code:
public $data['header'] = $this->load->view('header', null, TRUE);

Change To:

Code:
public $data['header'] = '';

public function __construct() {
  parent::__construct();
  $this->data['header'] = $this->load->view('header', null, TRUE);
#4

[eluser]solid9[/eluser]
thanks guys but I already solved the problem.




Theme © iAndrew 2016 - Forum software by © MyBB