public static function __callStatic($method, $arguments) { return view::render('markup/' . $method, variable_space::create('arguments', $arguments, 'text', array_shift($arguments))); }
* "appname". * * @author Thomas Urban * */ try { include 'rewritten.php'; // get application actually requested $application = txf::getContext()->application; // get script of application actually requested $script = path::glue($application->pathname, $application->script); // change to that folder for supporting homogenic use of relative pathnames chdir(dirname($script)); // include selected script include_once $script; // due to disabled shutdown handler we are required to call related handler manually view::current()->onShutdown(); } catch (http_exception $e) { header($e->getResponse()); view::variable('exception', $e); view::addBodyClass('exception'); view::addBodyClass('http-exception'); $data = variable_space::create('reason', $e); try { view::main(view::engine()->render('error/' . $e->getCode(), $data)); } catch (\UnexpectedValueException $dummy) { view::main(view::engine()->render('error/generic', $data)); } view::variable('title', $e->getStatus()); view::current()->onShutdown(); }
/** * Renders template using provided data. * * This method is managing exceptions thrown inside to bubble up to current * level of output buffering at least. * * @param string $template template name to render * @param variable_space|array $data data to use on rendering template * @return string rendered template */ public static function render($template = null, $data = null) { $oblevel = ob_get_level(); try { if ($data === null || is_array($data)) { $data = variable_space::fromArray((array) $data); } // @todo consider selecting engine depending on current configuration instead of using current view's one return static::engine()->render($template, $data); } catch (\Exception $e) { while ($oblevel < ob_get_level()) { ob_end_clean(); } static::error(log::exception('[%s:%s in %s@%d]', get_class($e), $e->getMessage(), $e->getFile(), $e->getLine())); return ''; } }