Welcome Guest, Not a member yet? Register   Sign In
Global variables in controllers
#5

[eluser]drewbee[/eluser]
True. I didn't catch on to that (read it to fast). One other option is to actually extend the CI Controller.

Code:
class MY_Controller extends Controller
{
    var $myCommonVar;

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

Then we have our new controller:

Code:
class Home extends MY_Controller
{
    function __construct()
    {
        parent::__construct();
    }
}

In the above controller, we now have access to myCommonVar by doing a $this->myCommonVar;

Hope this makes sense.


Messages In This Thread
Global variables in controllers - by El Forum - 09-11-2008, 08:00 AM
Global variables in controllers - by El Forum - 09-11-2008, 09:39 AM
Global variables in controllers - by El Forum - 09-11-2008, 09:40 AM
Global variables in controllers - by El Forum - 09-11-2008, 10:06 AM
Global variables in controllers - by El Forum - 09-11-2008, 10:44 AM
Global variables in controllers - by El Forum - 10-04-2008, 03:47 AM
Global variables in controllers - by El Forum - 10-04-2008, 07:59 AM
Global variables in controllers - by El Forum - 10-04-2008, 08:35 AM
Global variables in controllers - by El Forum - 10-04-2008, 09:32 AM



Theme © iAndrew 2016 - Forum software by © MyBB