Prior to Opencart 2.0 class properties could be accessed directly from the template. For example, $this->config->get('config_language')
or $this->request->get['route']
were both accessible from an admin template file.
With the new method $this->load->view()
, neither of these work. Is there a simple way to pass on class methods and properties which are available in the current controller to the tpl without explicitly adding them to the $data
array?
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
which holds everything. So you have to get these things form
$this->registry
like this
$this->registry->get('config')
it will work like
so your
becomes
like this
for more just simply print
$this->registry
in any template.