Return to Snippet

Revision: 34901
at October 30, 2010 01:54 by Savio


Initial Code
/* There are three ways to insert static blocks into magento templates */

/* 1.Inserting into example-template.phtml */

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


/* 2. Inserting into CMS */

{{block type="cms/block" block_id="MyCustomCMSPage" template="cms/example-template.phtml"}}

/* 3. Inserting into layout.xml */

	<layout>
	<example>
	<reference name="content">
	 <block type="cms/block" name="cms_store_check">
	 <action method="setBlockId"><block_id>MyCustomCMSPage</block_id></action>
	 </block>
	 </reference>
	 </example>
	</layout>

Initial URL

                                

Initial Description

                                

Initial Title
Magento: Inserting Static Block in Magento Templates

Initial Tags
php, xml, magento

Initial Language
XML