我有一些问题打开购物车;
Desc:我用名称和类创建计算器的控制器、视图、模型名称。
控制器:
class ControllerModuleCalculator extends Controller {
public function index() {
$this->language->load('module/calculator');
$this->data['someVariable'] = "Some Data";
$this->template = $this->config->get('config_template') . '/template/module/calculator.tpl');
$this->render();
}
视图:
<h2>Calculator View</h2>
<?php
print $someVariable;
?>
问题:转到:localhost/?Route =module/calculator,没有显示,只有白色屏幕
谢谢你的帮助
问题出在你的控制器上。
不是$this->render();
你必须打电话
$this->response->setOutput($this->render());
作为$this->render()
只呈现视图(在OpenCart中,这意味着变量对模板是透明的),但$this->response->setOutput();
确保呈现的模板在HTTP响应中显示给用户(返回给浏览器)。
试试这个->
进入管理面板,选择Setting->User Groups->Administrator
,检查Access Permission:
模块计算器是否检查,如果未检查并更新