Posts Tagged ‘Static Block magento’

Creating a new Static Block in Magento

November 22, 2010

In Magento 1.4, it’s not immediately obvious (or, in fact, obvious after several hours of staring) how to add a customised static block of text, html or anything else into the website. Like all things, once you know how, it’s pretty straightforward.

This is how I added a static item (in my case, an HTML submenu in the header) into my Magento website using the admin panel and by editing the header.phtml file which can be found in:


If you find this page doesn’t exist in your theme, copy it (along with the relevant directories if necessary) from the frontend/base/default theme.

Creating a new Static Block in Magento using the Admin Panel:

Step 1

Create a new block in the admin area – CMS/STATIC BLOCKS. Give the identifier a simple name with no spaces. We’ll call it NameOfStaticBlock.

Enter THIS IS WORKING in the text editing area. This will be replaced by the html or other code that you want to appear here.

Step 2

Open header.phtml (or the page where you would like this to appear, such as footer.phtml or 3columns.phtml) and in the position that you want your block to appear, paste:

<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('NameOfStaticBlock')->toHtml() ?>

When you refresh your home page, THIS IS WORKING (or your html) should appear in the position specified.