我收到如下错误
Recoverable Error: Argument 1 passed to Mage_Adminhtml_Controller_Action::_addContent() must be an instance of Mage_Core_Block_Abstract, boolean given,
我的indexAction代码如下所示
public function indexAction()
{
// instantiate the grid container
$brandBlock = $this->getLayout()
->createBlock('digitech_brandlogo_adminhtml/brandlogo');
// Add the grid container as the only item on this page
$this->loadLayout()
->_addContent($brandBlock)
->renderLayout();
}
在这种情况下,我的问题是“
是什么意思$brandBlock = $this->getLayout()
->createBlock('digitech_brandlogo_adminhtml/brandlogo');
“??
我想知道关于块和布局结构/安排。
答案 0 :(得分:0)
对不起,迟到的回答可能是这个帮助别人 您可以使用此代码,请将“my_block_name_here”和“activecodeline / developer.phtml”替换为您的块名称和模板路径
public function indexAction()
{
//Get current layout state
$this->loadLayout();
$block = $this->getLayout()->createBlock(
'Mage_Core_Block_Template',
'my_block_name_here',
array('template' => 'activecodeline/developer.phtml')
);
$this->getLayout()->getBlock('content')->append($block);
$this->renderLayout();
}