We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Volt generated php files are not updated

Hello , we are using Volt as our template engine with Phalcon . When we update .volt file it creates .php file if it doesnt exists , but if exists its not being updated.

After each changement on .volt we are manually deleting .php file to get updated one.

This is not a solution for production environment, but consider setting the php 'compileAlways' => true when you initialize volt.

Example:

$di->setShared('volt', function($view, $di) {

        $volt = new Volt($view, $di);

        $volt->setOptions(array(
            'compiledPath'  => '../var/cache/volt/',
            'compileAlways' => true
        ));

        return $volt;
    });

Take care.



98.9k

Volt compare the modification time of the compiled file to the original template to perform the compilation again. Maybe the filesystem is not registering those timestamps?

@strayobject thanks for your reply , but even though adding code block to my bootstrap it didnt work.

@Phalcon "Maybe the filesystem is not registering those timestamps?" this may be the case as it was working flawless before moving new server.How may i check and fix it ?

P.S i am working on an Ubuntu vps.



98.9k

Try editing a template, adding any random change and then doing a "ls -lh" will show you if the modification time has changed.

This was one of the wierdest issue i have ever experienced. When i run "date" the displayed server time was correct , but when i run "ls -lh" realised that ".volt" file's modification time was 3 hours back.

"touch xxx.volt" was updating modification date correctly but when i save .volt files from PHPED it was updating file modification time as 3 hours back.

Solved issue by right clicking project from PHPED > properties , from connection tab set the "Time offset ,h" value as "3", now any update at .volt files reflected [email protected] & @strayobject thanks for your helps !