So far I have created my own module with an index controller.

public function indexAction()
        $thing = $this->getLayout()->createBlock('Mage_Core_Block_Template','two',array('template' => 'myorg/mymod/mytemplate.phtml'));

I have been able to specify the layout of the controller programmatically, but I would like to specify it using the layout xml if that's possible.

Also I would like to specify this in such a way that I can use the

<?php $this->getChildHtml('xxx'); ?>

function in my template.

How do I do this?

P.S I am just at Hello world in the area of custom module making so I will need to know the correct xml conventions to use to add the template.

1 Answer 1


Put this code in handle of action in xml file of your module,


  <block type="core/text_list" name="root" output="toHtml">
       <block type="core/template" name="xxx" template="myorg/mymod/mytemplate.phtml"/>


Hope this helpful!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.