Created
May 19, 2010 16:47
-
-
Save ollym/406519 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/classes/kohana/view.php b/classes/kohana/view.php | |
index 17b6fb5..7bffe36 100644 | |
--- a/classes/kohana/view.php | |
+++ b/classes/kohana/view.php | |
@@ -130,6 +130,13 @@ class Kohana_View { | |
{ | |
$this->set_filename($file); | |
} | |
+ else | |
+ { | |
+ $foo = explode('_', get_class($this)); | |
+ array_shift($foo); | |
+ $file = strtolower(implode('/', $foo)); | |
+ $this->set_filename($file); | |
+ } | |
if ( $data !== NULL) | |
{ | |
@@ -333,6 +340,26 @@ class Kohana_View { | |
throw new Kohana_View_Exception('You must set the file to use within your view before rendering'); | |
} | |
+ foreach (get_object_vars($this) as $var => $value) | |
+ { | |
+ if (strpos($var, 'var_') === 0) | |
+ { | |
+ $this->set(str_replace('var_', '', $var), $value); | |
+ } | |
+ } | |
+ | |
+ // Get the var_ methods | |
+ foreach (get_class_methods($this) as $method) | |
+ { | |
+ if (strpos($method, 'var_') === 0) | |
+ { | |
+ $this->set(str_replace('var_', '', $method), $this->{$method}()); | |
+ } | |
+ } | |
+ | |
// Combine local and global data and capture the output | |
return View::capture($this->_file, $this->_data + View::$_global_data); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment