How to add a static cms block to all Magento pages?

I am new to magento and I am trying to create a static block for home, category and other pages. I want the static block to appear just above the footer link. And is there a good line tutorial that can provide a good overview of static blocks. How to use them in CMS and how we can generate them using PHP code.

+5
source share
3 answers

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 page or cms:

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

For reference, visit here.

+12
source
<?php 
    echo $this->getLayout()->createBlock('cms/block')->setBlockId('block_id')->toHtml(); 
    // toy can use this code in your template file.    
?>

cms, ,

{{block type="cms/block" block_id="your_block_id"}} 
// used in your cms pages like a short code
0

.phtml:

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

CMS:

{{block type="cms/block" block_id="my_block" template="cms/content.phtml"}}
0

All Articles