When you have to add a CMS Block and design it, you mostly need a custom wrapping css class. Is it not a good practice to write this into the CMS Block. So some of us creating a template file wherein the CMS Block is called, wrapped by a css class:
<div class="mrg-wrapper-class">
<?php echo $this->getLayout()->createBlock('cms/block')->setBlockId('mrg_business_terms')->toHtml() ?>
</div>
Better to insert static block in layout xml and wrap it with page/html_wrapper and add with actions needed html tags. You can find the functionality for html wrapper in ./app/code/core/Mage/Page/Block/Html/Wrapper.php
protected function _toHtml()
{
$html = empty($this->_children) ? '' : trim($this->getChildHtml('', true, true));
if ($this->_dependsOnChildren && empty($html)) {
return '';
}
if ($this->_isInvisible()) {
return $html;
}
$id = $this->hasElementId() ? sprintf(' id="%s"', $this->getElementId()) : '';
$class = $this->hasElementClass() ? sprintf(' class="%s"', $this->getElementClass()) : '';
$otherParams = $this->hasOtherParams() ? ' ' . $this->getOtherParams() : '';
return sprintf('<%1$s%2$s%3$s%4$s>%5$s</%1$s>', $this->getElementTagName(), $id, $class, $otherParams, $html);
}
public function getElementTagName()
{
$tagName = $this->_getData('html_tag_name');
return $tagName ? $tagName : 'div';
}
So the final layout xml code would be:
<reference name="content">
<block type="page/html_wrapper" name="mrg_wrapper" translate="label">
<action method="setElementClass"><value>mrg-wrapper-class</value></action>
<action method="setElementId"><value>mrg-wrapper-id</value></action>
<action method="setHtmlTagName"><value>span</value></action>
<!--<action method="setOtherParams"><value>selected="selected"</value></action>-->
<block type="cms/block" name="mrg_business_terms" as="mrg_business_terms">
<action method="setBlockId">
<block_id>mrg_business_terms</block_id>
</action>
</block>
</block>
</reference>