Magento静态CMS块存储在哪里? [英] Where are Magento static CMS blocks stored?
问题描述
我无法在数据库中放置静态CMS块.他们在哪里?
I cannot the location of static CMS blocks in the database. Where are they?
我需要知道的原因是,当我将数据库和主题文件从本地安装移动到在线dev-install时,该块不会更新,并且需要为每个安装重新创建它们.
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?
如果有人发现问题不清楚,我知道如何在Magento后端中制作一个静态块.问题是它们存储在Magento db/文件系统中的什么位置?
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?
推荐答案
块存储在数据库表cms_block
中.但是您不需要知道是否要以编程方式创建它们.
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();
这篇关于Magento静态CMS块存储在哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!