我正在尝试创建自定义模块(学习目的)以显示特定用户的付款详细信息。
我陷入了阻碍和布局之间,并出现了错误:
致命错误:调用成员函数append()
<?php
class PITS_Pitsnews_PaymentController extends Mage_Core_Controller_Front_Action {
protected function _getSession() {
return Mage::getSingleton('customer/session');
}
public function indexAction() {
$this->loadLayout();
$this->_initLayoutMessages('customer/session');
$session = $this->_getSession();
if (!$this->_getSession()->isLoggedIn()) {
$this->_redirect('customer/account/login/');
return;
}
$this->getLayout()->getBlock('pitsnews')->append(
$this->getLayout()->createBlock('pitsnews/pitsnews')
);
$this->getLayout()->getBlock('pitsnews/pitsnews')->assign('data', $data);
$this->renderLayout();
}
}
答案 0 :(得分:0)
好像是
$this->getLayout()->getBlock('pitsnews')
此处不是布局对象,因此请验证: