Welcome Guest, Not a member yet? Register   Sign In
Can Not extends Core Controller
#1

[eluser]qpixo[/eluser]
I'm trying to extend core Controller but it doesn't work after I upgraded CI to version 2.1.1
I can't see the display TEST log in, it's a blank page

Does anyone know how to fix that issue?

in direction application/core:
Code:
class MY_Controller extends CI_Controller {

// Defined a global user to all View
protected $user;

// Constructor
public function __construct() {
  
  parent::__construct();
  
  
  // Check if is member
  if($this->ion_auth->is_group('members')) {
   $data->user = $this->ion_auth->user()->row();
   $this->user = $data->user;
  
   // Load user to every Views
   $this->load->vars($data);
  } else {
   redirect('/');
  }
}
}

Then I extend this base controller in application/controllers/members

Code:
class Dashboard extends MY_Controller {

// Constructor of Dashboard
public function __construct() {
  
  parent::__construct();
  
  echo "TEST log in!!";
}

#2

[eluser]Samus[/eluser]
[quote author="qpixo" date="1340042305"]
Code:
class Dashboard extends MY_Controller {

// Constructor of Dashboard
public function __construct() {
  
  parent::__construct();
  
  echo "TEST log in!!";
}

[/quote]
Obviously, you're technically not echoing it in any 'page'.

try..

Code:
class Dashboard extends MY_Controller {

// Constructor of Dashboard
public function __construct() {
  
  parent::__construct();
  
function index() {
  echo "TEST log in!!";
}
}
#3

[eluser]qpixo[/eluser]
[quote author="Samus" date="1340043947"][quote author="qpixo" date="1340042305"]
Code:
class Dashboard extends MY_Controller {

// Constructor of Dashboard
public function __construct() {
  
  parent::__construct();
  
  echo "TEST log in!!";
}

[/quote]
Obviously, you're technically not echoing it in any 'page'.

try..

Code:
class Dashboard extends MY_Controller {

// Constructor of Dashboard
public function __construct() {
  
  parent::__construct();
  
function index() {
  echo "TEST log in!!";
}
}
[/quote]

I know it's just a lazy way to do it but yours still doesn't work...
#4

[eluser]Samus[/eluser]
sorry.
Code:
class Dashboard extends MY_Controller {

// Constructor of Dashboard
public function __construct() {
  
  parent::__construct();
  }
function index() {
  echo "TEST log in!!";
}


how about that?
#5

[eluser]TWP Marketing[/eluser]
Did you set the correct default controller in config/routes.php?
#6

[eluser]Matalina[/eluser]
Are you sure you are logged in?
#7

[eluser]qpixo[/eluser]
[quote author="TWP Marketing" date="1340047433"]Did you set the correct default controller in config/routes.php?[/quote]

Yes I did
#8

[eluser]qpixo[/eluser]
[quote author="Matalina" date="1340051636"]Are you sure you are logged in?
[/quote]

When I test and use CI_Controller I can see the page but not with my custom controller. What the heck? Is it a bug?
#9

[eluser]Matalina[/eluser]
The CI control doesn't redirect you. Your Custom controller does. Make sure everything in your construct is doing it's job correctly. Your extension looks correct it's the code in your construct that isn't doing it's job correctly.
#10

[eluser]Matalina[/eluser]
it should be in group not is group

Code:
$this->ion_auth->in_group('members')




Theme © iAndrew 2016 - Forum software by © MyBB