A simple trick to add static content block in template

Just go to your magento admin panel and then CMS -> Static Blocks

Now click on Add New Block button below and there will be a New Block form with some required fields. Now fill up all the required fields and save. Congrats! you have created your new static block . You have an identifier for your static block that you should remember for the next step. Now you can call your static block using the code below

<?php
echo $this->getLayout()->createBlock(‘cms/block’)->
setBlockId(‘yourIdentifierNameHere’)->toHtml()
?>

at anywhere in your template. You must replace setBlockId(‘yourIdentifierNameHere‘) “YourIdentifierNameHere” with your created  Static Block’s  identifier name.

[It may help you :D]

About these ads

Tags: , , , , , , , , ,

2 Responses to “A simple trick to add static content block in template”

  1. justin Says:

    i’m not sure how to add the echo code?index.php?

  2. shahriat Says:

    @justin, I don’t understand what do u mean by adding echo code?index.php? could u please explain it actually what is ur expectation?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


Follow

Get every new post delivered to your Inbox.

%d bloggers like this: