Changeset 1434
- Timestamp:
- 12/06/2007 04:45:58 PM (13 months ago)
- Files:
-
- 1 modified
-
trunk/system/libraries/View.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/system/libraries/View.php
r1410 r1434 19 19 // Set variables 20 20 protected $data = array(); 21 protected static $global_data = array(); 21 22 22 23 /** … … 79 80 80 81 /** 82 * Sets a view global variable. 83 * 84 * @param string|array name of variable or an array of variables 85 * @param value value when using a named variable 86 * @return object 87 */ 88 public function set_global($name, $value = NULL) 89 { 90 if ( ! is_array($name)) 91 { 92 $name = array($name => $value); 93 } 94 95 foreach ($name as $key => $value) 96 { 97 self::$global_data[$key] = $value; 98 } 99 100 return $this; 101 } 102 103 /** 81 104 * Magically sets a view variable. 82 105 * … … 130 153 if ($this->kohana_filetype === EXT) 131 154 { 155 // Merge global and local data, local overrides global with the same name 156 $data = array_merge(self::$global_data, $this->data); 157 132 158 // Load the view in the controller for access to $this 133 $output = Kohana::instance()->_kohana_load_view($this->kohana_filename, $ this->data);159 $output = Kohana::instance()->_kohana_load_view($this->kohana_filename, $data); 134 160 135 161 if ($renderer == TRUE AND is_callable($renderer, TRUE))
