January 18, 2011

Magento show custom static block only on homepage

In this post I will show how to create a custom static block in Magento and show the contents from this block on the Homepage. So in short, show a Static Block in a CMS Page.

The easy part is that we can do this in Magento Admin only. This is an example taken from one of my e-commerce websites www.paardcare.nl :

Content from the Static Block is highlighted. 

















  1. First, create a Static Block: CMS > Static Block > Create new Static Block. The Block identifier is important as we are going to call this block by this ID. You can put anything in the contents from this Block. We've created a <div> container with a <a href><img> construction.
  2. Next, edit the Homepage in CMS > Pages > [Homepage] > Custom Design > Layout update XML. Within the <reference name="left"> ... </reference> tag paste the following syntax/snippet:

    <block type="cms/block" name="[RANDOMNAME]" before="-">
        <action method="setBlockId"><block_id>[YOUR_BLOCK_IDENTIFIER]</block_id></action>
    </block>
That is all to it. Feel free to +1 this post to spread the word or click on a random banner on this site.

2 comments:

  1. The most ideal approach to get a sensibly evaluated logo plan that has been planned starting with no outside help explicitly for your bloom shop is to arrange one on the web. There are numerous custom logo configuration firms that will enable you to have contribution to the plan procedure.logo design service

    ReplyDelete
  2. I found your this post while searching for some related information on blog search...Its a good post..keep posting and update the information. custom pool construction horseshoe bay

    ReplyDelete