Static Blocks Magento

Hello all,

I am writing here the code for getting the status of the CMS static block of the required block id.

        $blockId = "category_block"; //block id to be assigned here
	$block = Mage::getModel('cms/block')
	echo $title = $block->getTitle(); // get block title
	$isActive = $block->getIsActive(); // get block status	
	    $block_html = Mage::getLayout()->createBlock('cms/block')->setBlockId($blockId)->toHtml(); //get block content if block is active				

Hope this is helpful

One thought on “Static Blocks Magento

Leave a Reply

Your email address will not be published. Required fields are marked *

Scroll to top