diff --git a/system/view.php b/system/view.php index e1d7c9a5..20cf26cb 100644 --- a/system/view.php +++ b/system/view.php @@ -194,10 +194,7 @@ class View { throw new \Exception("View [$view] does not exist."); } - foreach ($this->data as &$data) - { - if ($data instanceof View or $data instanceof Response) $data = (string) $data; - } + $this->get_sub_views(); extract($this->data, EXTR_SKIP); @@ -208,6 +205,22 @@ class View { return ob_get_clean(); } + /** + * Evaluate the content of all bound sub-views and responses. + * + * @return void + */ + private function get_sub_views() + { + foreach ($this->data as &$data) + { + if ($data instanceof View or $data instanceof Response) + { + $data = (string) $data; + } + } + } + /** * Add a view instance to the view data. *