/** * Present a template * @param string $template_file * @param array $params */ public static function presentTemplate($template_file, $params = array()) { Logging::log("configuring template variables for template {$template_file}"); if (!file_exists($template_file)) { throw new exceptions\TemplateNotFoundException("The template file <b>{$template_file}</b> cannot be found."); } foreach ($params as $key => $val) { ${$key} = $val; } if (array_key_exists('key', $params)) { $key = $params['key']; } if (array_key_exists('val', $params)) { $val = $params['val']; } /** * @global \thebuggenie\core\framework\Request The request object */ $tbg_request = Context::getRequest(); /** * @global \thebuggenie\core\framework\Response The response object */ $tbg_response = Context::getResponse(); /** * @global \thebuggenie\core\framework\Request The request object */ $tbg_routing = Context::getRouting(); /** * @global \thebuggenie\core\entities\User The user object */ $tbg_user = Context::getUser(); Context::loadLibrary('common'); Context::loadLibrary('ui'); Logging::log("rendering template '{$template_file}'"); require $template_file; }