diff --git a/app/config/conf.app.yml b/app/config/conf.app.yml index d2f073e..01819d0 100644 --- a/app/config/conf.app.yml +++ b/app/config/conf.app.yml @@ -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/ diff --git a/app/config/services.php b/app/config/services.php index 7271114..b540692 100644 --- a/app/config/services.php +++ b/app/config/services.php @@ -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();