Skip to content

Instantly share code, notes, and snippets.

@zombor
Created March 5, 2012 22:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zombor/1981603 to your computer and use it in GitHub Desktop.
Save zombor/1981603 to your computer and use it in GitHub Desktop.
diff --git a/classes/kohana/view.php b/classes/kohana/view.php
index 5427ad9..dbd5261 100644
--- a/classes/kohana/view.php
+++ b/classes/kohana/view.php
@@ -41,7 +41,7 @@ class Kohana_View {
* @param array $kohana_view_data variables
* @return string
*/
- protected static function capture($kohana_view_filename, array $kohana_view_data)
+ protected function capture($kohana_view_filename, array $kohana_view_data)
{
// Import the view variables to local namespace
extract($kohana_view_data, EXTR_SKIP);
@@ -136,6 +136,10 @@ class Kohana_View {
{
$this->set_filename($file);
}
+ else if ($this->_file)
+ {
+ $this->set_filename($this->_file);
+ }
if ($data !== NULL)
{
@@ -158,6 +162,11 @@ class Kohana_View {
*/
public function & __get($key)
{
+ if (method_exists($this, $key))
+ {
+ $data = $this->$key();
+ return $data;
+ }
if (array_key_exists($key, $this->_data))
{
return $this->_data[$key];
@@ -340,7 +349,7 @@ class Kohana_View {
}
// Combine local and global data and capture the output
- return View::capture($this->_file, $this->_data);
+ return $this->capture($this->_file, $this->_data);
}
} // End View
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment