Volt problem when i rename my controller

Hey guys,

This problem occurs when i renamed some of my controllers, before i have CurrentController name and i change it to CurrentprojectsController also i rename the view folder of this controller and delete everything on my cacheDir to make a new view file but the it returns

Warning: Phalcon\Mvc\View\Engine\Volt\Compiler::compileFile(C:\Users\spilagan20140973\Desktop\BOOTSTRAP FILES\PORTABLES\USBWebserver v8.6\root\PHALCON-BASE\app\config/../../app/cache/c__users_spilagan20140973_desktop_bootstrap files_portables_usbwebserver v8.6_root_phalcon-base_app_views_currentprojects_index.volt.php): failed to open stream: Invalid argument in C:\Users\spilagan20140973\Desktop\BOOTSTRAP FILES\PORTABLES\USBWebserver v8.6\root\PHALCON-BASE\public\index.php on line 31
Volt directory can't be written

but the other controller that I didn't rename works fine.



37.9k
edited Nov '14

This is cache of Volt, In order to solve it you must remove the volt folder and then create it

rm -rf app/cache/volt
mkdir app/cache/volt
edited Nov '14

I have tried to remove my cache folder and create a new one like you said app/cache/volt and on my config.php file i used

'cacheDir'       => __DIR__ . '/../../app/cache/volt/',

and have this code on my services.php


$di->set('view', function () use ($config) {

    $view = new View();

    $view->setViewsDir($config->application->viewsDir);

    $view->registerEngines(array(
        '.volt' => function ($view, $di) use ($config) {

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

            $volt->setOptions(array(
                'compiledPath' => $config->application->cacheDir,
                'compiledSeparator' => '_'
            ));

            return $volt;
        },
        '.phtml' => 'Phalcon\Mvc\View\Engine\Php'
    ));

    return $view;
}, true);

still i get the error



48.4k
edited Nov '14

For development set compileAlways to true and stat to true. Also make sure that the folder is readable by the webserver. Personally for development, I add my user to the webserver group and I add the webserver to my group. You should also have the webserver PHP checking and creating the voltCache directory. Later down the road you can optimize that into something more efficient if you need to.

Maybe this helps:

    switch (ENVIRONMENT) {
        case 'dist':
            $compileAlways = false;
            $stat = false;
            break;
        case 'dev':
            $compileAlways = true;
            $stat = true;
            break;
    }

    $volt = new Volt($view, $di);
    $volt->setOptions([
        'compileAlways' => $compileAlways,
        'stat' => $stat,
        'compiledPath' => // ...
        // ...
    ]);
    return $volt;
};

I have tried to run my project on my laptop and everything is working, but on my desktop its not, i already tried to delete my cache folder and make a new folder named it voltsrender and reconfig my config.php but still not working on my desktop. Whats causing this problem?