php - How to setting global variables in OpenCart 2.3.0.2? -


when want set global variable in template (.tpl files), use global in opencart 2.2 or older version.

for example:

<?php global $config; if($config->get('my_options')== 1) { ?>....<?php } ?> 

but, it not work in latest opencart 2.3.0.2

because predefined global $config in controller rather inconvenient (we have use config value in many template file). more experience have answer problem.

the least code defining them constants in config.php or admin/config.php, depending on need them. make these constants available throughout catalog or admin context.

another way using $this->config in controllers key/values out of setting table models or controllers.


Comments

Popular posts from this blog

Spring Boot + JPA + Hibernate: Unable to locate persister -

go - Golang: panic: runtime error: invalid memory address or nil pointer dereference using bufio.Scanner -

c - double free or corruption (fasttop) -