In my application am getting some values through webservice on the action index in controller. I want to use the same data in other actions also. How to implement it without calling webservice again.
Thanks.
In my application am getting some values through webservice on the action index in controller. I want to use the same data in other actions also. How to implement it without calling webservice again.
Thanks.
You could save the data in the session, see also the sessions section in the manual.
$data = $this->MyModel->findAll(); // or whatever your select looks like
$this->Session->write('myData',$data);
Then, in your other controller actions (irrespective of which specific controller you're using, provided they have the Session component turned on):
if($this->Session->check('myData')){
$data = $this->Session->read('myData');
}
Now your data lives in $data
and can be easily be sent to a view, etc.
For all of this to work, you're going to need to add this as a class-level variable to each controller where you'll want this data available:
var $components = array('Session');
Good luck!