5

I am new to magento and i am trying to create a static block for my home, category and other pages. i want the static block to be shown just above the footer link. And is there any good tutorial on line which can provide a good over view of static blocks. How to use them in CMS and how we can generate them using php Code.

ScoRpion
  • 11,364
  • 24
  • 66
  • 89

3 Answers3

12

Adding Static and non-static blocks directly to templates:

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

Short code inside another block or cms page :

{{block type="cms/block" block_id="your_block_id"}}

For Reference Visit Here

ScoRpion
  • 11,364
  • 24
  • 66
  • 89
Nasaralla
  • 1,839
  • 13
  • 11
0
<?php 
    echo $this->getLayout()->createBlock('cms/block')->setBlockId('block_id')->toHtml(); 
    // toy can use this code in your template file.    
?>

used in your cms pages like a short code

{{block type="cms/block" block_id="your_block_id"}} 
// used in your cms pages like a short code
Dave
  • 3,073
  • 7
  • 20
  • 33
Omprakash Patel
  • 532
  • 4
  • 15
0

To display Static block in .phtml files :

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

To display Static block in CMS pages :

{{block type="cms/block" block_id="my_block" template="cms/content.phtml"}}
Dave
  • 3,073
  • 7
  • 20
  • 33
Narine
  • 1
  • 2