1

I'm having trouble displaying links within my navigation from a static block.

I have included the following code at the top of my "home.phtml" file:

<?php $storeId = Mage::app()->getStore()->getStoreId();
if($storeId == '14')
{
    echo $this->getLayout()->createBlock('cms/block')->setBlockId('home-center-contact')->toHtml();
    echo $this->getLayout()->createBlock('cms/block')->setBlockId('top_menu_beacon')->toHtml();
    echo $this->getLayout()->createBlock('cms/block')->setBlockId('footer_links_beacon')->toHtml();
}
if($storeId == '19')
{
    echo $this->getLayout()->createBlock('cms/block')->setBlockId('home-center-contact')->toHtml();
    echo $this->getLayout()->createBlock('cms/block')->setBlockId('top_menu_cashino')->toHtml();
    echo $this->getLayout()->createBlock('cms/block')->setBlockId('footer_links_cashino')->toHtml();
}
if($storeId == '16')
{
    echo $this->getLayout()->createBlock('cms/block')->setBlockId('home-center-contact')->toHtml();
    echo $this->getLayout()->createBlock('cms/block')->setBlockId('top_menu_tanexpress')->toHtml();
    echo $this->getLayout()->createBlock('cms/block')->setBlockId('footer_links_tanexpress')->toHtml();
}
if($storeId == '18')
{
    echo $this->getLayout()->createBlock('cms/block')->setBlockId('home-center-contact')->toHtml();
    echo $this->getLayout()->createBlock('cms/block')->setBlockId('top_menu_merkur')->toHtml();
    echo $this->getLayout()->createBlock('cms/block')->setBlockId('footer_links_merkur')->toHtml();
}
?>
1
  • Did you added all the static block which you are using in your code? Commented Sep 6, 2018 at 10:38

2 Answers 2

4
You can follow below steps for display static block:

Step 1)Go to admin.

Step 2)Open Top menu System->Permissions->Blocks.

Step 3)click "Add New Block".

write your "Block Name" and Is Allowed "Yes".

Note: Block Name is type of your block for example "cms/block"
after Save Block.  

Step 4)Clear cache and refresh front page. Now Block is showing.

Thanks!
0

Tried to follow @Kirti Nariya's steps, follow below steps if you don't succeed in it.

1) If you use the latest Magento version 1.9.2.2, then you need to add first the block to Magento whitelist in the backend: System -> Permissions -> Block

For more details check below link http://www.dudesquare.nl/blog/2015/10/31/static-block-shortcodes-not-working-1-9-2-2/

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.