Welcome Guest, Not a member yet? Register   Sign In
Passing Variables from one controller to its extended controller
#6

[eluser]xtremer360[/eluser]
I figured out why it wasn't working. It was because I was putting the frontend and backend controllers in the libraries folder instead of the core folder. I do have one more issue at hand. I have a configuration file called defaults.php located in the config folder and I have this config file autoloaded properly. Inside of my backend controller I define a variable called $cms_template and make the value of the variable a config file item value. If I then load the login controller it gives me a 500 error but if I make the value of the cms template variable in the backend controller have the value of 'supr' then it loads the login controller fine? Why is that? Why can't I define the variable as the config item.

Backend Controller
Code:
<?php

if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Backend_Controller extends MY_Controller
{
    protected $cms_template = $this->config->item('cms_template');

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

Login Controller
Code:
<?php

if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Kowmgr_login extends Backend_Controller {

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

public function index()
{
  echo $this->cms_template;
}
}


Messages In This Thread
Passing Variables from one controller to its extended controller - by El Forum - 01-08-2013, 03:25 PM



Theme © iAndrew 2016 - Forum software by © MyBB