I am trying to create a module for toggling visibility of a sort of welcome announcement or special features announcement banner at the top of the screen on a Magento site ( I want to be able to toggle the visibility / presence of this banner via a UI element in the backend.

I don't want to have to edit my static blocks (beyond set-up), nor have to have the store owner navigate the backend to disable / enable, beyond a menu item or similar simple UI. Does Magento have any built-in mechanism to allow for this sort of UI control?

Here's some code snippets:

In the CMS, I created a static block with title "Header Hello Block" and id "header_hello_block", which looks like this:

<div class="holder">
<div class="hellobar">Hello, world!</div>

and in my app/design/frontend/default/themename/layout/page.xml I've entered the following, just after the html_header:

        <block type="cms/block" name="header_hello_block" before="-">
            <action method="setBlockId">

According to this article, that's all I should need to do in order to see my block rendered. What am I missing?

  • Can you show your code? Commented Jul 7, 2015 at 3:30
  • There's no code yet. Just a static block.
    – Jon Mitten
    Commented Jul 7, 2015 at 3:37

1 Answer 1


You can use before_body_start block to add your static block

<reference name="after_body_start">
<block type="cms/block" name="unique-name"> 
      <action method="setBlockId"><block_id>your-static-block</block_id></action> 

Use this code in your local.XML file.

  • before_body_start? are you sure about that? I cannot find that in any reference.
    – Jon Mitten
    Commented Jul 17, 2015 at 3:25
  • 1
    Check page.XML file and template/page/1column.phtml,2columns-left.phtml ,etc files. Commented Jul 17, 2015 at 3:33
  • I've done that, and updated my code above. Any hint as to why it's still not working?
    – Jon Mitten
    Commented Jul 17, 2015 at 4:36
  • Put your code in block name="before _body_start" Commented Jul 17, 2015 at 4:51
  • `<block type="page/html_header" name="header" as="header"> <block type="page/template_links" name="top.links" as="topLinks"/> <reference name="before_body_start"> <block type="cms/block" name="header_hello_block" before="-"> <action method="setBlockId"> <block_id>header_hello_block</block_id> </action> </block> </reference> This makes no difference. Do you mean "after_body_start"? I cannot find any "before" goo.gl/NzUNT4
    – Jon Mitten
    Commented Jul 17, 2015 at 4:55

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.