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
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.
-
So you have to put it in both local xml and header.phtml? or can you do eitherOli Tuck– Oli Tuck2016-04-16 14:09:02 +00:00Commented Apr 16, 2016 at 14:09
-
@OliTuck yep bothRaphael at Digital Pianism– Raphael at Digital Pianism2016-04-16 16:09:06 +00:00Commented Apr 16, 2016 at 16:09