Disable template caching for development in OpenCart 3

后端 未结 8 532
我寻月下人不归
我寻月下人不归 2020-12-02 01:41

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

相关标签:
8条回答
  • 2020-12-02 02:20

    Another way to do this: Open to system\library\template\Twig\Cache\Filesystem.php, find following lines of code

    public function load($key)
    {
        if (file_exists($key)) {
            @include_once $key;
        }
    }
    

    Comment out as in the following code:

    public function load($key)
    {
        // if (file_exists($key)) {
        //      @include_once $key;
        // }
    }
    

    This will remove the template cache of the twig and recreate every time, once development is over you have to remove the comment.

    0 讨论(0)
  • 2020-12-02 02:21

    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;
    
    0 讨论(0)
提交回复
热议问题