Really quick and simple question but I can't find a decent answer to this - What is the best way to pass data from a controller to a block in Magento.
Incase it makes a difference, I am loading the layout as follows:
$this->loadLayout(array('default', 'myModule_default'));
$this->_initLayoutMessages('customer/session')
->_initLayoutMessages('catalog/session')
->renderLayout();
I should add, that I have been using the registry as follows:
In the controller:
Mage::register('data', $data);
In the block:
$data = Mage::registry('data');
Not sure if this is the best way to do it though.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…