I have to create a template programmatically.
And so I need a master template with one child template. That child template again has two child templates.
Now I don't use a layout.xml file I need to call "setTemplate".
But how can I use "setTemplate" for the childs? MAgento can't find these child template because there is no reference to them.
I tried so far:
$layout = Mage::app()->getLayout();
$block = $layout->createBlock('core/template', 'master')
->setTemplate('default/html/master.phtml');
$blockChild1 = $layout->createBlock('core/template', 'master.child1')
->setTemplate('default/html/child1.phtml');
$blockChild1Child1 = $layout->createBlock('core/template', 'master.child1.child1')
->setTemplate('default/html/child1/child1.phtml');
$blockChild1Child2 = $layout->createBlock('core/template', 'master.child1.child2')
->setTemplate('default/html/child1/child2.phtml');
$blockChild1->setChild('master.child1', $blockItem);
$blockChild1->setChild('master.child1', $blockTotal);
$block->setChild('master', $blockInvoice);
$html = $block->toHtml();