Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where are Magento static CMS blocks stored?

Tags:

php

mysql

magento

I cannot the location of static CMS blocks in the database. Where are they?

The reason I need to know this is that when I move the database and my theme files from my local install to my online dev-install, the block does not update, and I need to re-create them for each installation.

Follow-up question would be, how do I create them programmatically?

EDIT: If anyone finds the question unclear I know how to make a static block in the Magento backend. The question is where are they stored in the Magento db/filesystem?

like image 609
pm. Avatar asked Feb 08 '11 11:02

pm.


1 Answers

Blocks are stored in the database table cms_block. But you don't need to know that if you are going to create them programmatically.

$newBlock = Mage::getModel('cms/block')
          ->setTitle('This is the title')
          ->setContent('This is the content')
          ->setIdentifier('an-identifier')
          ->setIsActive(true)
          ->setStores(array(1)) // see Sergy's comment
          ->save();
like image 128
clockworkgeek Avatar answered Oct 23 '22 18:10

clockworkgeek