2013-08-02 65 views
1

你好去一个管理页面Magento的定制管理页面块布局问题

PHP Fatal error: Call to a member function setSaveParametersInSession() on a non-object in app/code/core/Mage/Adminhtml/Block/Widget/Grid/Container.php on line 66

这里的时候,我不断收到以下错误是我的控制器:

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(); 
} 

} 

现在,当我用google搜索这个问题的时候,每个人都会说它是一个不正常的_controller declration,但是从阅读他们说,我应该使用我的名字。任何帮助将是真棒谢谢

+0

请尝试检查此[链接](http://www.magentocommerce.com/boards/viewthread/184145/)。 – Dinesh

+0

因此,如果你看到我已经发布的代码** $ this - > _ controller ='adminhtml_main'; **我已经看到该帖子,并根据该帖子ni肩膀有问题 – mdw

回答

2

再次检查您的文件夹结构,以确保所有文件都位于正确的路径。

在我这个问题的情况下,该文件被放置在错误的位置。我将Grid.php放在controller/Adminhtml文件夹中,而不是Block/Adminhtml/<modulename>/Grid.php