Welcome Guest, Not a member yet? Register   Sign In
Passing Data from Constructor to Method
#2

[eluser]summery[/eluser]
Hi pgoneill!

I think what you're doing is probably fine, but to be safe I would use $this->load->vars instead of creating your own $this->data variable.

$this->load->vars is terrific - not only does it make data in the constructor available in your controller, it also makes it automatically available to all views. It's a life-saver if you have a bunch of nested views, because that way you don't have to pass zillions of $data arrays to all of your partial views. Just give everything a good name in your $load->vars array and you're good to go.

Read more about $this->load->vars in the Loader Class documentation.

Good luck!
~S


Messages In This Thread
Passing Data from Constructor to Method - by El Forum - 12-07-2009, 12:57 PM
Passing Data from Constructor to Method - by El Forum - 12-08-2009, 12:33 PM



Theme © iAndrew 2016 - Forum software by © MyBB