Me again (i'm probably the biggest newbie in this forum), i'm having trouble trying to add Volt's compiledPath folder into my config file (index.php), here is the code of my index.php:
<?php
try {
//Register an autoloader
$loader = new \Phalcon\Loader();
$loader->registerDirs(array(
'../app/controllers/',
'../app/models/'
))->register();
//Create a DI
$di = new Phalcon\DI\FactoryDefault();
//Set the database service
$di->set('mongo', function() {
$mongo = new Mongo();
return $mongo->selectDb("sample_db");
}, true);
//Setting up the view component
$di->set('view', function(){
$view = new \Phalcon\Mvc\View();
$view->setViewsDir('../app/views/');
#ativando a templateEngine Volt
$view->registerEngines(array(
".phtml" => 'Phalcon\Mvc\View\Engine\Volt'
));
return $view;
});
$di->set('collectionManager', function(){
return new Phalcon\Mvc\Collection\Manager();
}, true);
//Handle the request
$application = new \Phalcon\Mvc\Application();
$application->setDI($di);
echo $application->handle()->getContent();
} catch(\Phalcon\Exception $e) {
echo "PhalconException: ", $e->getMessage();
}
How exacly do i configure the compiledPath into this file? I've tried registering:
$di->set('volt', function($view, $di) {
$volt = new \Phalcon\Mvc\View\Engine\Volt($view, $di);
$volt->setOptions(array(
"compiledPath" => "../app/cache/volt/"
));
return $volt;
}, true);
before it but it didn't work. And i don't understand well why. I need to create another kind of config file just for this $di->set('volt' ?