Disable template caching for development in OpenCa

2019-01-09 17:23发布

I am making changes in my theme templates in OpenCart 3. Due to template caching I have to clear cache every time under "storage/cache" directory. It is very annoying when working and previewing changes frequently during development. Please provide some solution how we can configure caching according to production and development environment.

Note: I have already searched for solutions online but there is no solution related to template caching. Solutions are available to disable image caching but "Image Caching" and "Template Caching" are different features provided in Opencart.

4条回答
Lonely孤独者°
2楼-- · 2019-01-09 17:47

Scott's answer is best but in case it's not available due to version or you want to disable it programmatically you can do this anywhere before the twig is rendered:

$this->config->set('template_cache', false);
查看更多
forever°为你锁心
3楼-- · 2019-01-09 17:47

You can also do this from CODE directly if you have the access. Go to this file path below via ftp or cPanel:

system\library\template\Twig\Environment.php

Find

$this->debug = (bool) $options['debug'];

Replace:

$this->debug = (bool) true;
查看更多
【Aperson】
4楼-- · 2019-01-09 17:49

I think you edit the template as the path: Design->Theme Editor before.

Clear all of the date in the oc_theme data table of your database.

查看更多
The star\"
5楼-- · 2019-01-09 17:50

You might need to upgrade to a more recent version of OpenCart3 - the first one (3.0.0.0) didn't have a way of doing this in the GUI.

More recent versions, such as 3.0.2.0, have a gear on the admin dashboard. Click the gear and you get options to disable caching.

enter image description here

查看更多
登录 后发表回答