layout xml
Magento2:
Find proper layout.xml and copy file into /app/design/frontend/vendor/theme/Magento_Theme/layout/xxx.xml
Add block
<block class="Magento\Cms\Block\Block" name="contactFormInfo">
<arguments>
<argument name="block_id" xsi:type="string">contact-form-info</argument>
</arguments>
</block>
Magento:
In php:
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('xxx')->toHtml(); ?>
Test if on home page and if block is enabled:
<?php if ($this->getIsHomePage()):?>
<?php if (Mage::getModel('cms/block')->load('banner_ad_home')->getIsActive()): ?>
<div class="banner-ad"><?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('banner_ad_home')->toHtml(); ?></div>
<?php endif?>
<?php else:?>
<?php if (Mage::getModel('cms/block')->load('banner_ad_internal')->getIsActive()): ?>
<div class="banner-ad"><?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('banner_ad_internal')->toHtml(); ?></div>
<?php endif?>
<?php endif?>
In Layout Update XML:
<reference name="content">
<block type="cms/block" name="ad.bucket1" as="adbucket1" before="-">
<action method="setBlockId"><block_id>ad-bucket1</block_id></action>
</block>
</reference>
Inline in CMS page
{{block type="cms/block" block_id="block_name" template="folder/template_name.phtml"}}
{{block type="page/html_topmenu" name="catalog.topnav" template="page/html/topmenu.phtml"}}
!! block layout list !!
http://go.magento.com/support/kb/entry/name/standard-block-layout
OR
<reference name="content">
<block type="core/template" name="ad_block" template="cms/ad-bucket.phtml"></block>
</reference>