Example #1
0
 /**
  * @param null $template
  * @param null $cache_id
  * @param null $compiled_id
  * @param null $parent
  * @return string
  *
  * @throws \SmartyException
  */
 public function get_template($template = null, $cache_id = null, $compiled_id = null, $parent = null)
 {
     $this->init_engine();
     $this->template_engine->setCompileDir($this->compile_dir);
     foreach ($this->template_dirs as $i => $dir) {
         $i == 0 && $this->template_engine->setTemplateDir($dir);
         $i > 0 && $this->template_engine->addTemplateDir($dir);
     }
     $this->load_lang_vars($this->get_lang_file());
     return $this->template_engine->getTemplate($template, $cache_id, $compiled_id, $parent);
 }
 public static function show_error($message)
 {
     /**
      * @var $system \System
      */
     $system = Application::get_class(\System::class);
     $smarty = new \Smarty();
     $smarty->setTemplateDir($system->get_path() . DS . 'templates');
     $smarty->setCompileDir($system->get_path() . DS . 'templates_c');
     $error_class = 'error-block';
     $params = ['class' => $error_class, 'message' => $message];
     $smarty->assign($params);
     echo $smarty->getTemplate('message.tpl.html');
 }
 protected function show_result(GetResponse $response)
 {
     /**
      * @var $template Template
      */
     $template = Application::get_class(\Starter::class);
     $smarty = new \Smarty();
     $bundle_file = ROOT_PATH . DS . 'static_builder' . DS . 'bundle.result.json';
     $bundle_result = json_decode(file_get_contents($bundle_file), true);
     $smarty->assign('bundle_result', $bundle_result);
     if (strpos(Request::uri(), 'admin_panel') !== false) {
         $smarty->setTemplateDir($template->get_path() . DS . 'templates' . DS . 'admin_panel');
     } else {
         $smarty->setTemplateDir($template->get_path() . DS . 'templates' . DS . 'site');
     }
     $smarty->setCompileDir($template->get_path() . DS . 'templates_c');
     $smarty->assign($response->blocks);
     $smarty->assign('title', new PageTitle());
     echo $smarty->getTemplate('index' . DS . 'index.tpl.html');
 }
Example #4
0
 private function show_result()
 {
     /**
      * @var $view ExtensionView
      */
     $view = Application::get_class(LeftMenuView::class);
     $this->response->blocks['left'] = $view->render();
     $view = Application::get_class(TopMenuView::class);
     $this->response->blocks['top'] = $view->render();
     $smarty = new \Smarty();
     $bundle_file = ROOT_PATH . DS . 'static_builder' . DS . 'bundle.result.json';
     $bundle_result = json_decode(file_get_contents($bundle_file), true);
     $smarty->assign('bundle_result', $bundle_result);
     $smarty->assign($this->response->blocks);
     /**
      * @var $ext \Tools
      */
     $ext = Application::get_class(\Tools::class);
     $smarty->setTemplateDir($ext->get_path() . DS . 'templates' . DS . 'index');
     $smarty->setCompileDir($ext->get_path() . DS . 'templates_c');
     echo $smarty->getTemplate('index.tpl.html');
 }