Here’s a good question on StackOverflow recently…
Good Morning, I want to know if there’s a magical way to pass variable created in the controllerModule to the ViewModule. exemple:$this->assign['result'] => $resultValue;
and in the view display()echo $this->request['result'];
Maybe there’s a better way to exchange data between Controller and View? Thanks you.
There is a good way, as pointed out by Cédric Mourizard of SugarCRM Gold Partner Synolia. You can use the
view_object_map property of the Controller class as shown below…
view_object_mapvar is made for you.
In your controller you could do:$this->view_object_map['myDataKey'] = 'MyData';
And you could retrieve your data easily like that:$this->ss->assign('myData', $this->view_object_map['myDataKey']);
Thanks Cedric for the great answer here!