Accessing class properties and methods from template

一笑奈何 提交于 2019-12-06 15:26:37
Nikhil Chaudhary

In Opencart version 2, if you want these variables then you can easily access them. There is slight change is code, now you can use

$this->registry 

which holds everything. So you have to get these things form

$this->registry

like this

$this->registry->get('config')

it will work like

$this->config  

so your

$this->config->get('config_language')

becomes

$this->registry->get('config')->get('config_language')

like this

$this->request->get['route'] == $this->registry->get('request')->get['route'];

$this->request->post['route'] == $this->registry->get('request')->post['route'];

$this->request->files['file'] == $this->registry->get('request')->files['file'];

for more just simply print $this->registry in any template.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!