Skip to content

Commit

Permalink
Merge pull request #38 from abackstrom/37-partials-in-views
Browse files Browse the repository at this point in the history
Restore $response->_view after render()
  • Loading branch information
chriso committed Apr 29, 2012
2 parents cf36b8a + 93ed8f3 commit 8978056
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion klein.php
Expand Up @@ -522,6 +522,8 @@ public function yield() {

//Renders a view + optional layout
public function render($view, array $data = array()) {
$original_view = $this->_view;

if (!empty($data)) {
$this->set($data);
}
Expand All @@ -534,6 +536,9 @@ public function render($view, array $data = array()) {
if (false !== $this->chunked) {
$this->chunk();
}

// restore state for parent render()
$this->_view = $original_view;
}

// Renders a view without a layout
Expand Down Expand Up @@ -757,4 +762,4 @@ public function __call( $method, $args ) {
return call_user_func_array( $this->$method, $args );
}
}
}
}

0 comments on commit 8978056

Please sign in to comment.