Created
November 1, 2012 04:16
-
-
Save phalcon/3991682 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Initializes the view and Volt | |
* | |
* @param array $options | |
*/ | |
protected function initView($options = array()) | |
{ | |
$config = $this->_di->get('config'); | |
$di = $this->_di; | |
$this->_di->set( | |
'volt', | |
function($view, $di) use($config) | |
{ | |
$volt = new Volt($view, $di); | |
$volt->setOptions( | |
array( | |
'compiledPath' => ROOT_PATH . $config->app->volt->path, | |
'compiledExtension' => $config->app->volt->extension, | |
'compiledSeparator' => $config->app->volt->separator, | |
'stat' => (bool) $config->app->volt->stat, | |
) | |
); | |
return $volt; | |
} | |
); | |
/** | |
* Setup the view service | |
*/ | |
$this->_di->set( | |
'view', | |
function() use ($config, $di) | |
{ | |
$view = new \Phalcon\Mvc\View(); | |
$view->setViewsDir(ROOT_PATH . $config->app->path->views); | |
$view->registerEngines(array('.volt' => 'volt')); | |
return $view; | |
} | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment