Code for creating new static block

For creating the static block using the magneto script set the title,content, identifier as shown below.

function createBlock($blockData) {

   $block = Mage::getModel('cms/block')->load($blockData['identifier']);
    $block->setTitle($blockData['title']);
    $block->setIdentifier($blockData['identifier']);
    $block->setStores(array($blockData['storeId']));
    $block->setIsActive($blockData['active']);
    $block->setContent($blockData['content']);
    $block->save();
}

Share this Tutorial