Welcome Guest, Not a member yet? Register   Sign In
Variable scope
#1

[eluser]The Mask[/eluser]
Hi,
I'd like to define variables in a controller that ALL other controllers extend so that they are available in any controller and any function.

i.e.

class My_Controller extends Controller
{
var $data = 123;

etc...
}

class Home extends My_Controller
{

function index()
{
$this->load->view( 'home_view', $data );
}

}

I have a scoping issue with $data, what is the best way to achieve this?
I know I can introduce 'global' scope for $data but is there anything in CI I can use?

Thanks


Messages In This Thread
Variable scope - by El Forum - 08-09-2008, 11:06 AM
Variable scope - by El Forum - 08-09-2008, 11:22 AM
Variable scope - by El Forum - 08-09-2008, 01:28 PM



Theme © iAndrew 2016 - Forum software by © MyBB