Welcome Guest, Not a member yet? Register   Sign In
Model's variables scope
#2

[eluser]WanWizard[/eluser]
In a standard CI setup, executing two controllers means two different page requests.

The web is stateless, one request is not aware of any other request. If you want to pass data from one request to the next, you have to use sessions.

If you mean multiple methods of a single controller, that should work. All CI classes are loaded as singletons, so
Code:
function func1()
{
    $this->load->model('testmodel');
    $this->testmodel->var = 'test';
}
function func2()
{
    echo $this->testmodel->var; // should echo 'test'
}
should work without problems.


Messages In This Thread
Model's variables scope - by El Forum - 07-13-2010, 06:58 AM
Model's variables scope - by El Forum - 07-13-2010, 08:58 AM



Theme © iAndrew 2016 - Forum software by © MyBB