Beispiel #1
0
 /**
  * @param $name
  * @param array $params
  */
 public static function parse($template_name, $params = array())
 {
     if (is_array($GLOBALS)) {
         extract($GLOBALS);
     }
     if (is_array($params)) {
         extract($params);
     }
     $session = Mvc::getSession();
     $request = Mvc::getRequest();
     $response = Mvc::getResponse();
     $config = Mvc::getConfig();
     $router = Mvc::getRouter();
     $dispatcher = Mvc::getDispatcher();
     foreach ($params as $varname => $value) {
         $response->setData($varname, $value);
     }
     unset($varname, $value, $params);
     foreach (array(LP_APP_DIRECTORY, LP_DEFAULT_APP_DIRECTORY, LP_ROOT_DIRECTORY) as $_dir) {
         $template_path = "{$_dir}/templates/{$template_name}.php";
         if (is_file($template_path)) {
             // Execute the template
             require $template_path;
             return;
         }
     }
     throw new \Exception("Template not found: /templates/{$template_name}.php");
 }