Magento – Display static block data in controller method

controllersmagento-1.9static-block

Hello,

I have created one static block.
I want to display data from that static block in my controller method.

Here is my controller method:

<?php
class NameSpace_Module_IndexController extends Mage_Core_Controller_Front_Action
{
    public function IndexAction()
    {
        $this->loadLayout();
        $this->renderLayout();
    }
}

If I write following line in controller method:

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

then static block data is displaying above the header.

I want to show that static block content should come after header part.

Best Answer

Frontend layout file as below

<layout version="0.1.0">
    <moulename_index_index>
        <reference name="content">
            <block type="modulename/index" name="example" />
         </reference>
    </moulename_index_index>
</layout>
Related Topic