public function __construct()
 {
     $this->loader = AssetsLoader::getInstance(__DIR__ . '/..', 'www', __DIR__);
     /*
     echo '<pre>';
     var_export($loader);
     var_export($loader->getAssetsPath());
     var_export($loader->getAssetsWebPath());
     exit('yo');
     */
     $this->template_engine = TemplateEngine::getInstance();
     $this->template_engine->guessFromAssetsLoader($this->loader)->setLayoutsDir(__DIR__ . '/../www/')->setToTemplate('setCachePath', __DIR__ . '/tmp')->setToTemplate('setAssetsCachePath', __DIR__ . '/tmp')->setToView('setIncludePath', __DIR__ . '/views');
 }
 public function __construct()
 {
     $this->loader = AssetsLoader::getInstance(__DIR__ . '/..', 'www', __DIR__, AssetsLoader::PRESETS_NO_CONFLICT);
     /*
     echo '<pre>';
     var_export($loader);
     var_export($loader->getAssetsPath());
     var_export($loader->getAssetsWebPath());
     exit('yo');
     */
     $this->template_engine = TemplateEngine::getInstance(TemplateEngine::THROW_ALL_ERRORS);
     $this->template_engine->setPageLayout(self::$default_page_layout)->guessFromAssetsLoader($this->loader)->setLayoutsDir(__DIR__ . '/../www/')->setToTemplate('setCachePath', __DIR__ . '/tmp')->setToTemplate('setAssetsCachePath', __DIR__ . '/tmp')->setToView('setIncludePath', __DIR__ . '/views');
 }
 public function render($format = 'html')
 {
     if (!empty($this->type)) {
         $_meth = 'render' . ucfirst($this->type);
         if (method_exists($this->profiler, $_meth)) {
             $this->profiler->setCurrentEntity($this->entity);
             return $this->profiler->{$_meth}(!empty($this->format) ? $this->format : $format);
         }
         return var_export($this->entity, 1);
     } else {
         $template_engine = TemplateEngine::getInstance();
         try {
             $template_engine->setToView('setIncludePath', __DIR__ . '/views')->guessFromAssetsLoader(AssetsLoader::getInstance(__DIR__ . '/../../', 'www', defined('_DEVDEBUG_DOCUMENT_ROOT') ? _DEVDEBUG_DOCUMENT_ROOT : __DIR__ . '/../../www'));
         } catch (\Exception $e) {
             return $e->getMessage();
         }
         $template_engine->getTemplateObject('MetaTag')->add('robots', 'none');
         $params = array('debug' => $this, 'reporter' => $template_engine, 'title' => 'The system encountered an error!', 'subheader' => $this->profiler->renderProfilingTitle(), 'slogan' => $this->profiler->renderProfilingInfo(), 'profiler_content' => 'profiler_content.html', 'profiler_footer' => 'profiler_footer.html', 'show_menu' => false, 'show_backtotop_handlers' => false);
         // messages ?
         if (!empty($this->messages)) {
             $params['messages'] = self::renderMessages($this->messages, !empty($this->format) ? $this->format : $format);
         }
         // others
         $params['stacks'] = array();
         $params['menu'] = array();
         foreach (self::getStacks() as $_i => $_stack) {
             $params['menu'][$_stack->getTitle()] = '#' . $_i;
             $params['stacks'][] = self::renderStack($_stack, !empty($this->format) ? $this->format : $format);
         }
         // this will display the layout on screen and exit
         try {
             $params['content'] = $template_engine->render('partial_html.html', $params);
             $str = $template_engine->renderLayout(null, $params);
         } catch (\Exception $e) {
             return $e->getMessage();
         }
         echo $str;
         exit;
     }
     return '';
 }
 /**
  * Set the object Assets Loader instance and dispatch required template envionement
  *
  * @param   \Assets\Loader $loader
  * @return  self
  */
 public function guessFromAssetsLoader(AssetsLoader $loader)
 {
     $this->setAssetsLoader($loader);
     $this->setLayoutsDir($this->assets_loader->getAssetsRealPath())->setToTemplate('setWebRootPath', $this->assets_loader->getAssetsWebPath())->setToView('addDefaultViewParam', 'assets', $this->assets_loader->getAssetsWebPath())->setToTemplate('setWebRootPath', $this->assets_loader->getDocumentRoot());
     return $this;
 }