你好,我在转到管理页面时一直收到以下错误
PHP致命错误:在第66行的app/code/core/Mage/Adminhtml/Block/Widget/Gridge/Container.PHP中的非对象上调用成员函数setSaveParametersInSession()
这是我的控制器:
class LTS_Categorymove_Adminhtml_BlacklistController extends Mage_Adminhtml_Controller_Action{
public function indexAction(){
$this->loadLayout();
var_dump(Mage::getSingleton('core/layout')->getUpdate()->getHandles());
$this->renderLayout();
}
}
这是我的主要区块:
class LTS_Categorymove_Block_Adminhtml_Main extends Mage_Adminhtml_Block_Widget_Grid_Container{
protected $_addButtonLabel = 'Add New Example';
public function __construct(){
//error_log('fgboo');
$this->_controller = 'adminhtml_main';
$this->_blockGroup = 'categorymove';
$this->_headerText = 'Blacklist';
$this->_addButtonLabel = 'Button Here';
parent::__construct();
}
protected function _prepareLayout(){
$this->setChild( 'grid',
$this->getLayout()->createBlock( $this->_blockGroup.'/' . $this->_controller . '_grid',
$this->_controller . '.grid')->setSaveParametersInSession(true) );
return parent::_prepareLayout();
}
}
现在,当我在谷歌上搜索这个问题时,每个人都说这是一个不正确的_controller清理,但从周围的阅读中,他们说我应该使用我现在的块名。任何帮助都会很棒,感谢
再次检查文件夹结构,确保所有文件都位于正确的路径。
就我这个问题而言,文件放错了位置。我将Grid.php
放在controller/Adminhtml
文件夹中,而不是Block/Adminhtml/<modulename>/Grid.php