|
Hi everyone,
I want to add a new template to the adminhtml/dashboard module, but I’m doing something wrong.
I created and activated a custom Dashboard block, like so:
class MyNamespace_Adminhtml_Block_Dashboard extends Mage_Adminhtml_Block_Dashboard { public function __construct() { parent::__construct(); $this->setTemplate('mynamespace/dashboard/index.phtml'); } }
I also created mynamespace/dashboard/index.phtml and it’s working.
The problem is that I want to create a new child called MyNamespace_Adminhtml_Block_Dashboard_Stats. I added _prepareLayout() to the above class:
class MyNamespace_Adminhtml_Block_Dashboard extends Mage_Adminhtml_Block_Dashboard { public function __construct() { parent::__construct(); $this->setTemplate('mynamespace/dashboard/index.phtml'); }
protected function _prepareLayout() { $this->setChild('stats', $this->getLayout()->createBlock('mynamespace/adminhtml/dashboard_stats') );
parent::_prepareLayout(); } }
The problem is when I call $this->getChildHtml(’stats’) from mynamespace/dashboard/index.phtml, nothing is rendered:
$this->getChildHtml('stats')
I made sure to add the blocks to mynamespace/app/etc/local.xml:
<blocks> <adminhtml> <rewrite> <dashboard>MyNamespace_Adminhtml_Block_Dashboard</dashboard> </rewrite> <rewrite> <dashboard_stats>MyNamespace_Adminhtml_Block_Dashboard_Stats</dashboard_stats> </rewrite> </adminhtml> </blocks>
What am I missing?
Thanks,
Andy
|