Im trying to pass information from my controller to the template.
My Controller:
$response= "test"; (variable that I want to pass to PHTML)
$this->loadLayout( array('default','path_to_test_phtml'));
$block = $this->getLayout()->createBlock('block_name')
->setData('response', $response)
->setTemplate('path_to_test.phtml');
$block->setResponse($response); //magic method
$this->renderLayout();
My Block:
public function _prepareLayout()
{
return parent::_prepareLayout();
}
My Template:
<?php
$response = $this->getResponse();
?>
<?php echo $this->response; ?>
My Layout:
<path_to_test_phtml>
<reference name="content">
<block type="block/name" name="track_bynumber" template="path_to_test_phtml.phtml"/>
</reference>
</path_to_test_phtml>
No information "test" appear in the template.. any help appreciated. brgds