添加Block/里面的文档时,需要特别注意一些地方,其中包括在Form.php中addField的时候,示例代码如下:
$fieldset->addField('todo', 'select', array( 'label' => Mage::helper('education')->__('Todo'), 'name' => 'todo', 'values' => array( array( 'value' => 'do', 'label' => Mage::helper('education')->__('Do'), ), array( 'value' => 'dont', 'label' => Mage::helper('education')->__('Dont'), ), array( 'value' => '0', 'label' => Mage::helper('education')->__('Please select'), ), ), )); $fieldset->addField('subject', 'text', array( 'label' => Mage::helper('education')->__('Subject'), 'name' => 'subject', )); $fieldset->addField('content', 'editor', array( 'label' => Mage::helper('education')->__('Content'), 'name' => 'content', 'style' => 'width:600px; height:400px;', 'wysiwyg' => true, ));你能发现有这段代码什么问题吗?它确实有问题,问题就在content这个单词,在type为editor的情况下,如果id和name为content,页面就会变形,猜测原因可能是content和editor编辑器的样式定义有冲突。
修改之后code如下:
$fieldset->addField('contents', 'editor', array(
'label' => Mage::helper('education')->__('Content'),
'name' => 'contents',
'style' => 'width:600px; height:400px;',
'wysiwyg' => true,
));
问题解决!