CodeIgniter Forums

Full Version: Extending CI_Controller issues
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am in the process of moving form CI2 to CI3.

In my app, I have my own extended Controller library, extending CI_Controller.

It is actually extended twice, Front_Controller extends MY_Controller, wich extends CI_Controller.

This allowed me to have shared data in MY_Controller and then some user specific stuff in Front_Controller. This worked well in CI2.

But now in CI3, I am having issues with implenting a global data array that I can use to, for example, put data into a view.

It looks like using parent::__construct() is the problem, and my controller, which uses Front_Controller, is loading its view before grabbing data from the construct method in Front_Controller, which gives me "Undefined variable" errors.

So, in CI3, how can I get my extended Controller library to get global data from the construct method before attempting to load the view?