Loading Magento child html outside of Magento

Posted by Christian Thamer on Stack Overflow See other posts from Stack Overflow or by Christian Thamer
Published on 2011-01-02T07:50:46Z Indexed on 2011/01/02 7:53 UTC
Read the original article Hit count: 583

Filed under:
|
|

I am loading Magento blocks outside of Magento for certain parts of my site. I can do this successfully with something similar the following.

require_once $docRoot.'/app/Mage.php';
umask(0);
Mage::app('default');
...

$layout = Mage::getSingleton('core/layout');
$block = $layout->createBlock('Mage_Page_Block_Html_Header');
$block->setTemplate('page/html/header.phtml');
echo $block->renderView();

The problem is that if the block I am rending has child blocks(html) they are not included in the output. In the example above the file header.phtml contains the following call for child html that is missing from the output.

...
<?php echo $this->getChildHtml('topLinks') ?>
...

© Stack Overflow or respective owner

Related posts about layout

Related posts about magento