Esempio n. 1
0
 function render_file($file, $locals = array(), $use_full_path = false)
 {
     if ($use_full_path) {
         $file = $this->views_path . '/' . $file . '.' . Znap::$views_extension;
     }
     if (is_file($file)) {
         if (is_object($this)) {
             foreach ($this as $tmp_key => $tmp_value) {
                 ${$tmp_key} =& $this->{$tmp_key};
             }
             unset($tmp_key, $tmp_value);
         }
         if ($this->content_for_layout !== null) {
             $content_for_layout =& $this->content_for_layout;
         }
         if (count($locals)) {
             foreach ($locals as $tmp_key => $tmp_value) {
                 ${$tmp_key} =& $locals[$tmp_key];
             }
             unset($tmp_key, $tmp_value);
         }
         unset($use_full_path, $locals);
         Znap::$currently_rendering_snippet = $this->snippet;
         $this->currently_rendering_file = $file;
         include $file;
         Znap::$currently_rendering_snippet = null;
         return true;
     }
     return false;
 }