Welcome Guest, Not a member yet? Register   Sign In
[Q]How to get instance of the Invoking Controller
#6

[eluser]m4rw3r[/eluser]
get_instance() returns the instance of the first (usually the only) loaded controller.

Example:
Code:
class Foo extends Controller{
    var $bar = 'Foo';
    function index(){
        echo $this->bar;

        $CI =& get_instance();
        $CI->bar = 'bar';

        echo $this->bar;
    }
}

This should echo Foobar if I didn't mess up somewhere.


Messages In This Thread
[Q]How to get instance of the Invoking Controller - by El Forum - 09-03-2008, 11:31 AM
[Q]How to get instance of the Invoking Controller - by El Forum - 09-03-2008, 12:54 PM
[Q]How to get instance of the Invoking Controller - by El Forum - 09-03-2008, 03:07 PM
[Q]How to get instance of the Invoking Controller - by El Forum - 09-03-2008, 04:45 PM
[Q]How to get instance of the Invoking Controller - by El Forum - 09-03-2008, 11:06 PM
[Q]How to get instance of the Invoking Controller - by El Forum - 09-04-2008, 07:09 AM
[Q]How to get instance of the Invoking Controller - by El Forum - 09-04-2008, 08:31 AM
[Q]How to get instance of the Invoking Controller - by El Forum - 09-04-2008, 09:26 AM
[Q]How to get instance of the Invoking Controller - by El Forum - 09-04-2008, 09:54 AM



Theme © iAndrew 2016 - Forum software by © MyBB