OpenCart 模板创建 module 简单步骤

假如我想创建一个侧边栏模块sidebar,让每一个页面都可以复用,步骤如下:
1. 在controller/module目录下新建sidebar.php文件。
2. 添加文件内容为:
class ControllerModuleSidebar extends Controller {
	protected function index($setting) {
		$this->template = $this->config->get('config_template') . '/template/module/sidebar.tpl';
		$this->render();
	}
}
3. 在template/module创建sidebar.tpl模板文件。
4. 在调用的controller引用:
$this->data['sidebar'] = $this->getChild('module/sidebar');
5. 在模板文件使用: echo $sidebar;
最后我想说 OpenCart 真是一款优秀的开源电子商务软件,以后我会写更多关于 OpenCart 的内容。

OpenCart 模板创建 module 简单步骤》上有1条评论

留下评论