0

In my custom module, I want to add a custom link in the header, but not within the top links. I can't edit the header.phtml. I prefer add link through layout

http://i.prntscr.com/971IF0J_SGm72aCvgkq1GQ.png

0

The header block is not of type text_list which would automatically echo all of it's child blocks, therefor you have to manually specify each block that you want to output. In other words, you have to change the header.phtml template

0

You should add something in header.phtml because he can't render automatically all the blocks in content, but you can do it properly like this:

app/design/frontend/{package}/{theme}/layout/local.xml

<reference name="header">
    <block type="core/template" name="new.link" template="page/html/header/link.phtml"/>
</reference>

app/design/frontend/{package}/{theme}/template/page/html/header/link.phtml

<a href="#">My new link</a>

app/design/frontend/{package}/{theme}/template/page/html/header.phtml

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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