3

I have made a simple static block which is just an unordered list containing social links that I would like to place into my header. How would I go about inserting it into my header via local.xml? thanks

1 Answer 1

6

To do so add the following code to your local.xml file under the <default> handle:

<reference name="header">
    <block type="cms/block" name="my_block">
        <action method="setBlockId">
            <block_id>my_block</block_id>
        </action>
    </block>
</reference>

Then in your template/page/html/header.phtml you can do

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

This is assuming your static block identifier is my_block which is unlikely so you will have to replace this value with your static block id in the code I provided.

2
  • So you have to put it in both local xml and header.phtml? or can you do either Commented Apr 16, 2016 at 14:09
  • @OliTuck yep both Commented Apr 16, 2016 at 16:09

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.