Calling the static block from phtml files – Magento 1x
I know for beginners calling the static blocks into your phtml template file could be intimidating. But don’t worry this tutorial makes you easy but appropriate steps. I hope you already downloaded and install the magento and working on your project.
Login into the admin panel and hover over the cms nav and click on the static blocks
Step 2:
After that you will see the static block manage page, click on the add new block button and enter
Block Title: Enter the block name. For example Homepage Advertisement
Identifier: Enter the block identifier. For example homepage_advertisement. The identifier is one which will be used to call in the phtml file.
Store View: Select the appropriate store to display that block
Status: Select enabled
Content: Enter the content
Step 3:
Go to the template folder (app > design > frontend > themename > default > template > page > 1column.phtml). Use another .phtml file if you want to implement that static block. For this tutorial, I am using 1column.phtml. And use this code
<?php
echo $this->getLayout()->createBlock('cms/block')->setBlockId('block_indentifier')->toHtml();
?>
<?php
echo $this->getLayout()->createBlock('cms/block')->setBlockId('homepage_advertisement')->toHtml();
?>
The homepage_advertisement static block was created in step 2. After you have saved the file, please don’t forget to clear the cache.