my view setup is undergiven. The compiled path is not working, i.e. the compiled file filename.volt.php
is not saving in app/cache/volt
but saving in the same directory as of the view file.
can anyone help?
$di->set('view', function() use ($config, $di) {
$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' => APP_PATH . '/cache/volt/',
'compiledSeparator' => '_',
$volt->getCompiler()->addFilter(
'repspace',
function($resolvedArgs, $exprArgs) {
return ' str_replace(" ", "_", '.$resolvedArgs.')';
}
),
$volt->getCompiler()->addFunction("echo", function($args, $expr) {
$args = explode(',', $args);
$var = $args[0];
$default = isset($args[1]) ? $args[1] : '';
return "isset($var) ? $var : $default";
})
));
return $volt;
}));
// Set the translator service as a shared variable on the view.
$view->setVar('t', $di->getTranslator());
return $view;
}, true);