コード例 #1
0
 /**
  * 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);
 }
コード例 #2
0
ファイル: index.php プロジェクト: webappbuilder/base-app
 /**
  * Translate message
  *
  * @package     base-app
  * @version     2.0
  *
  * @param string $string string to translate
  * @param array $values replace substrings
  *
  * @return string translated string
  */
 function __($string, array $values = NULL)
 {
     return \Baseapp\Library\I18n::instance()->_($string, $values);
 }
コード例 #3
0
ファイル: Bootstrap.php プロジェクト: al35mm/Phalcon-Rocket
 /**
  * Catch the exception and log it, display pretty view
  *
  * @param \Exception $e
  */
 public static function exception(\Exception $e)
 {
     $config = \Phalcon\DI::getDefault()->getShared('config');
     $errors = array('error' => get_class($e) . '[' . $e->getCode() . ']: ' . $e->getMessage(), 'info' => $e->getFile() . '[' . $e->getLine() . ']', 'debug' => "Trace: \n" . $e->getTraceAsString() . "\n");
     if ($config->app->env == "development") {
         // Display debug output
         $debug = new \Phalcon\Debug();
         $debug->onUncaughtException($e);
     } else {
         // Display pretty view of the error
         $di = new \Phalcon\DI\FactoryDefault();
         $view = new \Phalcon\Mvc\View\Simple();
         $view->setDI($di);
         $view->setViewsDir(APP_PATH . '/app/frontend/views/');
         $view->registerEngines(\Baseapp\Library\Tool::registerEngines($view, $di));
         echo $view->render('error', array('i18n' => I18n::instance(), 'config' => $config));
         // Log errors to file and send email with errors to admin
         \Baseapp\Bootstrap::log($errors);
     }
 }