Welcome Guest, Not a member yet? Register   Sign In
Application structure?
#5

[eluser]Jelmer[/eluser]
That's because the $data array is only available within the constructor and not outside it.

You could save it as a object property and then you'll be able to access it outside the constructor. Like this:
Code:
<?php
class MY_Controller extends Controller {

    var $modulelist;

    function MY_Controller()
    {
        parent::Controller();
        $this->load->model('Modules');
        $this->modulelist = $this->Modules->getmodules();
    }

}

And then in your controller you can access it as $this->modulelist, just be carefull not to use a variable name that could conflict with a library or model because it shares the same name (it will be overwritten the second you load the library).


Messages In This Thread
Application structure? - by El Forum - 04-18-2010, 05:38 AM
Application structure? - by El Forum - 04-18-2010, 12:46 PM
Application structure? - by El Forum - 04-18-2010, 02:16 PM
Application structure? - by El Forum - 04-18-2010, 04:13 PM
Application structure? - by El Forum - 04-18-2010, 04:20 PM
Application structure? - by El Forum - 04-18-2010, 04:25 PM
Application structure? - by El Forum - 04-18-2010, 04:27 PM



Theme © iAndrew 2016 - Forum software by © MyBB