我是magento的新手并尝试使用admin grid.admin网格工作正常,但添加和编辑页面显示空白页面。 我的代码中是否有任何问题。
来自控制器的行动。
<footer>
从块
编辑信息public function editAction()
{
$testId = $this->getRequest()->getParam('info_id');
$testModel = Mage::getModel('test/info')->load($testId);
if ($testModel->getInfoId() || $testId == 0)
{
Mage::register('test_data', $testModel);
$this->loadLayout();
$this->_setActiveMenu('test/info_book');
$this->_addBreadcrumb('test Manager', 'test Manager');
$this->_addBreadcrumb('Test Description', 'Test Description');
$this->getLayout()->getBlock('head')
->setCanLoadExtJs(true);
$this->_addContent($this->getLayout()
->createBlock('test/adminhtml_info_edit'))
->_addLeft($this->getLayout()
->createBlock('test/adminhtml_info_edit_tabs')
);
var_dump($this->getLayout()->getUpdate()->getHandles());
$this->renderLayout();
}
else
{
Mage::getSingleton('adminhtml/session')
->addError('Test does not exist');
$this->_redirect('*/*/');
}
}
来自
的信息编辑class Demo_Test_Block_Adminhtml_Info_Edit extends
Mage_Adminhtml_Block_Widget_Form_Container{
public function __construct()
{
parent::__construct();
$this->_objectId = 'id';
$this->_blockGroup = 'test';
$this->_controller = 'adminhtml_info';
$this->_updateButton('save', 'label','save reference');
$this->_updateButton('delete', 'label', 'delete reference');
}
public function getHeaderText()
{
return 'Add a contact';
}
}
conf文件
class Demo_Test_Block_Adminhtml_Info_Edit_Form extends
Mage_Adminhtml_Block_Widget_Form
{
protected function _prepareForm()
{
$form = new Varien_Data_Form(
array(
'id' => 'edit_form',
'action' => $this->getUrl('*/*/save', array('info_id' => $this->getRequest()->getParam('info_id'))
),
'method' => 'post',
)
);
$form->setUseContainer(true);
$this->setForm($form);
return parent::_prepareForm();
}
}