Ways to Insert Static Blocks Into Magento Templates

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*
* Insert into template.phtml
*/
<?php
     echo $this->getLayout()->createBlock('cms/block')->setBlockId('BLOCKNAMEHERE')->toHtml() ;
?>
 
 
/* 
 * Insert into the CMS
*/
{{block type="cms/block" block_id="BLOCKNAMEHERE" template="cms/example-template.phtml"}}
 
 
/*
 * Insert into the layout.xml
*/
<layout>
    <example>
        <reference name="content">
            <block type="cms/block" name="cms_store_check">
	        <action method="setBlockId"><block_id>BLOCKNAMEHERE</block_id></action>
	    </block>
        </reference>
    </example>
</layout

Post written by Ed Reckers

Founder and lead web development consultant at Red Bridge Internet : San Francisco WordPress Developers and Consultants.

Leave a Reply