Search code examples
phpphalconvolt

Volt.php files not auto-updating


While using the volt template the files ending with .volt would auto generate a volt.php file and if any changes were made to the volt file, the volt.php file would not be updated unless deleted manually for it to generate a new volt.php file. Is there a way for it to auto-update when changes were made?

Thanks in advance.


Solution

  • There wasn't. I don't think this has changed. You can however set compileAlways flag while in development, or set it depending on your app environment variable, if you use one. Read this for more details.

    $di->set('view', function(){
        $view = new \Phalcon\Mvc\View();
        $view->setViewsDir('../app/views/');
    
            $view->registerEngines(array(
                '.volt' => function($view, $di) {
                $volt = new \Phalcon\Mvc\View\Engine\Volt($view, $di);
                $volt->setOptions(array(
                  'compiledPath' => '../app/compiled/',
                  'stat' => true,
                  'compileAlways' => true  
                ));
                return $volt;
                }
            ));
    
        return $view;
    });