0

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

public function indexAction()
{
        $this->loadLayout();
        $thing = $this->getLayout()->createBlock('Mage_Core_Block_Template','two',array('template' => 'myorg/mymod/mytemplate.phtml'));
        $this->getLayout()->getBlock('content')->append($thing);
        $this->renderLayout();
}

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

1

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

<yourmodule_yourcontroller_youraction>

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


</yourmodule_yourcontroller_youraction>

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.