我无法在数据库中定位静态CMS块.他们在哪?
我需要知道的原因是,当我将数据库和我的主题文件从本地安装移动到我的在线开发安装时,该块不会更新,我需要为每个安装重新创建它们.
后续问题是,如何以编程方式创建它们?
编辑:如果有人发现问题不清楚,我知道如何在Magento后端制作一个静态块.问题是它们存储在Magento db/filesystem中的哪个位置?
clo*_*eek 20
块存储在数据库表中cms_block
.但是,如果要以编程方式创建它们,则无需知道.
$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();
Run Code Online (Sandbox Code Playgroud)
小智 7
它们在db表中cms_block
就像发条geek所说的那样,但要注意,如果你通过sql将它们添加到db中(例如使用模块安装脚本),你还需要将新创建的块id和store id添加到表中cms_block_store
或者块不会出现.