I have created custom module and I need to add button in header.phtml which 'onclick' will call a method from my module but i'm not sure how to do this. Should I create block and template or any other way? Can you give me some tips because "View" part is still a mystery for me.

1 Answer 1


Furoris:Create block class and template file and layout file call this template and make header as reference block.Then on header.phtml call this block using getChildHtml();

just Like:

<default><!-  call on all pages -->
<reference name="header">
<block type="yourBLockPrefix/restofblockclass" name="myblockcustom" template="mytem patefoder/mytemplate.phtml"/>


add the code <php echo $this->getChildHtml('myblockcustom')?>

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.