app/config/services.php: adding template service.
This commit is contained in:
parent
eb62be5d86
commit
823f6d2e3f
2 changed files with 20 additions and 0 deletions
|
|
@ -4,6 +4,7 @@ application:
|
|||
modelsDir : ../app/models/
|
||||
migrationsDir : ../app/migrations/
|
||||
viewsDir : ../app/views/
|
||||
templateDir : ../app/templates/
|
||||
listenersDir : ../app/listeners/
|
||||
libraryDir : ../app/library/
|
||||
formsDir : ../app/forms/
|
||||
|
|
|
|||
|
|
@ -178,6 +178,25 @@ $di->setShared('view', function () use ($di, $config) {
|
|||
return $view;
|
||||
});
|
||||
|
||||
$di->set('template', function() use ($config) {
|
||||
$view = new Phalcon\Mvc\View\Simple();
|
||||
$view->setViewsDir($config->application->templateDir);
|
||||
$view->registerEngines([
|
||||
'.volt' => function ($view, $di) use ($config) {
|
||||
$volt = new VoltEngine($view, $di);
|
||||
|
||||
$volt->setOptions(array(
|
||||
'compiledPath' => $config->application->viewCacheDir,
|
||||
'compiledSeparator' => '_',
|
||||
));
|
||||
|
||||
return $volt;
|
||||
},
|
||||
'.phtml' => 'Phalcon\Mvc\View\Engine\Php'
|
||||
]);
|
||||
return $view;
|
||||
});
|
||||
|
||||
$di->setShared('assets', function () {
|
||||
|
||||
$manager = new AssetsManager();
|
||||
|
|
|
|||
Reference in a new issue