Example #1
0
 static function element($view = '', $withLayout = true)
 {
     self::$current = $view;
     $view = VIEWS_PATH . $view . "." . self::$_extension;
     if (self::exists($view)) {
         extract(View::$vars);
         include $view;
     }
     return false;
 }
Example #2
0
 public function callTag($name, $attrs, $body = null, $view = null)
 {
     $method = 'tag' . ucfirst($name);
     if (!method_exists($this, $method)) {
         throw new Exception(T('Unknown tag: %s::%s', get_class($this), $name), E_ERROR);
     }
     array_push($this->bodies, $body);
     if (!$view) {
         $view = View::current();
     }
     if ($attrs) {
         if (!is_array($attrs) && !is_object($attrs)) {
             throw new InvalidArgumentException('Tags accept only arrays and objects as attributes');
         }
     }
     $attrs = (object) $attrs;
     $result = $this->{$method}($attrs, $view);
     array_pop($this->bodies);
     return $result;
 }