/** * Render views from volt files * * @package base-app * @version 2.0 */ public function voltAction() { $this->view->setVars(array('i18n' => I18n::instance(), 'auth' => Auth::instance())); ob_start(); $e = ''; foreach (array('frontend', 'backend') as $module) { foreach ($iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(ROOT_PATH . '/app/' . $module . '/views/', \RecursiveDirectoryIterator::SKIP_DOTS), \RecursiveIteratorIterator::SELF_FIRST) as $item) { if (!$item->isDir() && $item->getExtension() == 'volt') { $this->view->setViewsDir(ROOT_PATH . '/app/' . $module . '/views/'); $subPath = $iterator->getSubPathName(); $file = strstr($item->getFilename(), '.volt', true); $dir = strstr($subPath, $item->getFilename(), true); $e .= $this->view->partial($dir . $file); } } } ob_get_clean(); //\Baseapp\Console::log($e); }
/** * Set the auth service * * @return void */ protected function auth() { $this->_di->setShared('auth', function () { return Auth::instance(); }); }