Пример #1
0
 public static function cleanParams($name = null)
 {
     if ($name) {
         unset(self::$params[$name]);
     } else {
         self::$params = array();
     }
 }
Пример #2
0
 /**
  * Renders a view. Accepts either a function and its parameters, or a
  * template path and the data to pass to it.
  */
 public static function render($view, $params = null)
 {
     // determine the parameters
     if (func_num_args() > 2) {
         $params = func_get_args();
         array_shift($params);
     } elseif ($params === null) {
         $params = self::$params;
     }
     // reset params for the next call
     self::$params = array();
     // render and return the response
     if (is_callable($view)) {
         return $view($params);
     }
     return self::$tpl->render($view, $params);
 }